Update to rust 2015-03-26
authorAlex Crichton <alex@alexcrichton.com>
Thu, 26 Mar 2015 18:17:44 +0000 (11:17 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 26 Mar 2015 18:59:30 +0000 (11:59 -0700)
50 files changed:
Cargo.lock
Cargo.toml
src/bin/cargo.rs
src/cargo/core/dependency.rs
src/cargo/core/manifest.rs
src/cargo/core/resolver/mod.rs
src/cargo/core/source.rs
src/cargo/lib.rs
src/cargo/ops/cargo_compile.rs
src/cargo/ops/cargo_new.rs
src/cargo/ops/cargo_rustc/compilation.rs
src/cargo/ops/cargo_rustc/context.rs
src/cargo/ops/cargo_rustc/custom_build.rs
src/cargo/ops/cargo_rustc/mod.rs
src/cargo/ops/cargo_test.rs
src/cargo/ops/registry.rs
src/cargo/sources/git/source.rs
src/cargo/sources/registry.rs
src/cargo/util/config.rs
src/cargo/util/dependency_queue.rs
src/cargo/util/errors.rs
src/cargo/util/graph.rs
src/cargo/util/paths.rs
src/cargo/util/sha256.rs
src/cargo/util/toml.rs
src/registry/lib.rs
src/rustversion.txt
src/snapshots.txt
tests/support/git.rs
tests/support/mod.rs
tests/support/registry.rs
tests/test_cargo_bench.rs
tests/test_cargo_build_auth.rs
tests/test_cargo_clean.rs
tests/test_cargo_compile.rs
tests/test_cargo_compile_custom_build.rs
tests/test_cargo_compile_git_deps.rs
tests/test_cargo_compile_path_deps.rs
tests/test_cargo_compile_plugins.rs
tests/test_cargo_cross_compile.rs
tests/test_cargo_doc.rs
tests/test_cargo_features.rs
tests/test_cargo_package.rs
tests/test_cargo_profiles.rs
tests/test_cargo_publish.rs
tests/test_cargo_registry.rs
tests/test_cargo_run.rs
tests/test_cargo_test.rs
tests/test_cargo_version.rs
tests/tests.rs

index 29c5d503c6bbf0075aa1b100959ddf888a851128..fb944b0c410f57acd7cc72c3852fa07873b5db0b 100644 (file)
@@ -3,28 +3,28 @@ name = "cargo"
 version = "0.1.0"
 dependencies = [
  "advapi32-sys 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "curl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "docopt 0.6.52 (registry+https://github.com/rust-lang/crates.io-index)",
- "env_logger 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "flate2 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "git2 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "git2-curl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "glob 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "curl 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "docopt 0.6.54 (registry+https://github.com/rust-lang/crates.io-index)",
+ "env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "flate2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2-curl 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glob 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)",
  "kernel32-sys 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "log 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
  "registry 0.1.0",
- "rustc-serialize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "semver 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "semver 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
  "tar 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "tempdir 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "term 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tempdir 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "term 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "threadpool 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "time 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
- "toml 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.2.27 (registry+https://github.com/rust-lang/crates.io-index)",
+ "toml 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
  "winapi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -43,90 +43,90 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "curl"
-version = "0.2.3"
+version = "0.2.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "curl-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
+ "curl-sys 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.2.27 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "curl-sys"
-version = "0.1.16"
+version = "0.1.17"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "libz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libz-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "docopt"
-version = "0.6.52"
+version = "0.6.54"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-serialize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "env_logger"
-version = "0.2.3"
+version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "log 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "flate2"
-version = "0.2.0"
+version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "miniz-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "miniz-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "gcc"
-version = "0.3.2"
+version = "0.3.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "git2"
-version = "0.2.5"
+version = "0.2.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "libgit2-sys 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.2.27 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libgit2-sys 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "git2-curl"
-version = "0.2.1"
+version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "curl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "git2 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "log 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.2.27 (registry+https://github.com/rust-lang/crates.io-index)",
+ "curl 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "glob"
-version = "0.2.6"
+version = "0.2.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "hamcrest"
 version = "0.1.0"
-source = "git+https://github.com/carllerche/hamcrest-rust.git#27a3368a915aabdee09c9f2c515127689715c1d9"
+source = "git+https://github.com/carllerche/hamcrest-rust.git#2dbf32e738935f7ebb5223b31b8fc1fe6327adf8"
 
 [[package]]
 name = "kernel32-sys"
@@ -143,14 +143,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "libgit2-sys"
-version = "0.2.5"
+version = "0.2.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "libssh2-sys 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
- "libz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libssh2-sys 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libz-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -163,26 +163,26 @@ dependencies = [
 
 [[package]]
 name = "libssh2-sys"
-version = "0.1.13"
+version = "0.1.15"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "libz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libz-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "libz-sys"
-version = "0.1.1"
+version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "pkg-config 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "log"
-version = "0.2.6"
+version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -195,27 +195,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "miniz-sys"
-version = "0.1.3"
+version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "gcc 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gcc 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "openssl-sys"
-version = "0.5.1"
+version = "0.5.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "gcc 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gcc 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "libressl-pnacl-sys 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "pkg-config 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "pkg-config"
-version = "0.3.1"
+version = "0.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -225,34 +225,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "rand"
-version = "0.2.1"
+version = "0.3.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "log 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "regex"
-version = "0.1.20"
+version = "0.1.21"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "registry"
 version = "0.1.0"
 dependencies = [
- "curl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-serialize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "curl 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "rustc-serialize"
-version = "0.3.6"
+version = "0.3.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "semver"
-version = "0.1.16"
+version = "0.1.17"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -262,15 +262,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "tempdir"
-version = "0.3.2"
+version = "0.3.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "rand 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "term"
-version = "0.2.1"
+version = "0.2.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "kernel32-sys 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -287,25 +287,25 @@ name = "time"
 version = "0.1.21"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "gcc 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gcc 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "toml"
-version = "0.1.18"
+version = "0.1.19"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "rustc-serialize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "url"
-version = "0.2.27"
+version = "0.2.28"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-serialize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
index f88b90f9e61da83bc8ee3f62937d0478a9903b78..360ce18c5c6d81755fb214d171b95e6e2d0ceebd 100644 (file)
@@ -19,8 +19,8 @@ git2 = "0.2.1"
 git2-curl = "0.2.1"
 glob = "0.2.2"
 time = "0.1.19"
-log = "0.2.5"
-env_logger = "0.2.2"
+log = "0.3.0"
+env_logger = "0.3"
 docopt = "0.6.45"
 url = "0.2.23"
 rustc-serialize = "0.3.1"
index b203bb0f240e1a4e97f5057b84d5d4034a0e5d3a..83ad3087f6f2a9165162165f2932af033b274ec3 100644 (file)
@@ -1,9 +1,9 @@
 #![feature(core, exit_status, fs_ext)]
 
-extern crate "git2-curl" as git2_curl;
-extern crate "rustc-serialize" as rustc_serialize;
 extern crate cargo;
 extern crate env_logger;
+extern crate git2_curl;
+extern crate rustc_serialize;
 extern crate toml;
 #[macro_use] extern crate log;
 
index 0d3bbaa3ba8f5bdccd797f5580722844d3b43f98..bf7378fd51b82384d39bb7850c1b005a606f4946 100644 (file)
@@ -67,13 +67,13 @@ impl Dependency {
     pub fn source_id(&self) -> &SourceId { &self.source_id }
     pub fn kind(&self) -> Kind { self.kind }
     pub fn specified_req(&self) -> Option<&str> {
-        self.specified_req.as_ref().map(|s| s.as_slice())
+        self.specified_req.as_ref().map(|s| &s[..])
     }
 
     /// If none, this dependencies must be built for all platforms.
     /// If some, it must only be built for the specified platform.
     pub fn only_for_platform(&self) -> Option<&str> {
-        self.only_for_platform.as_ref().map(|s| s.as_slice())
+        self.only_for_platform.as_ref().map(|s| &s[..])
     }
 
     pub fn set_kind(mut self, kind: Kind) -> Dependency {
index 552455acc0f65e5ab19dad63a9d7a0b32d2b8753..e9e42cdebae660265e9dd2df510ff5acc53de713 100644 (file)
@@ -214,7 +214,7 @@ impl Manifest {
     pub fn warnings(&self) -> &[String] { &self.warnings }
     pub fn profiles(&self) -> &Profiles { &self.profiles }
     pub fn links(&self) -> Option<&str> {
-        self.links.as_ref().map(|s| s.as_slice())
+        self.links.as_ref().map(|s| &s[..])
     }
 
     pub fn add_warning(&mut self, s: String) {
@@ -235,7 +235,7 @@ impl Target {
         Target {
             kind: TargetKind::Bin,
             name: String::new(),
-            src_path: PathBuf::new(""),
+            src_path: PathBuf::new(),
             metadata: None,
             doc: false,
             doctest: false,
index ef581f0741edae6e86c1da2f65eca0c4c53c9803..ff1f0a01f223d3afae89d0b84a05eed9f0bdcbf2 100644 (file)
@@ -256,7 +256,7 @@ fn activate_deps<'a>(cx: Box<Context>,
 
     let key = (dep.name().to_string(), dep.source_id().clone());
     let prev_active = cx.activations.get(&key)
-                                    .map(|v| v.as_slice()).unwrap_or(&[]);
+                                    .map(|v| &v[..]).unwrap_or(&[]);
     trace!("{}[{}]>{} {} candidates", parent.name(), cur, dep.name(),
          candidates.len());
     trace!("{}[{}]>{} {} prev activations", parent.name(), cur,
@@ -473,7 +473,7 @@ fn resolve_features<'a>(cx: &mut Context, parent: &'a Summary,
     // features are bugs in that the package does not actually have those
     // features.
     if feature_deps.len() > 0 {
-        let unknown = feature_deps.keys().map(|s| s.as_slice())
+        let unknown = feature_deps.keys().map(|s| &s[..])
                                   .collect::<Vec<&str>>();
         if unknown.len() > 0 {
             let features = unknown.connect(", ");
index fe9e33171ed4c7848c4a6f57a3337ca24d27f4f9..f186e342e5d66b7b5908cdb4e890fdb21a5f522a 100644 (file)
@@ -109,7 +109,7 @@ impl SourceId {
                 let mut reference = GitReference::Branch("master".to_string());
                 let pairs = url.query_pairs().unwrap_or(Vec::new());
                 for &(ref k, ref v) in pairs.iter() {
-                    match k.as_slice() {
+                    match &k[..] {
                         // map older 'ref' to branch
                         "branch" |
                         "ref" => reference = GitReference::Branch(v.clone()),
@@ -196,22 +196,20 @@ impl SourceId {
     pub fn load<'a>(&self, config: &'a Config) -> Box<Source+'a> {
         trace!("loading SourceId; {}", self);
         match self.inner.kind {
-            Kind::Git(..) => Box::new(GitSource::new(self, config)) as Box<Source>,
+            Kind::Git(..) => Box::new(GitSource::new(self, config)),
             Kind::Path => {
                 let path = match self.inner.url.to_file_path() {
                     Ok(p) => p,
                     Err(()) => panic!("path sources cannot be remote"),
                 };
-                Box::new(PathSource::new(&path, self, config)) as Box<Source>
-            },
-            Kind::Registry => {
-                Box::new(RegistrySource::new(self, config)) as Box<Source>
+                Box::new(PathSource::new(&path, self, config))
             }
+            Kind::Registry => Box::new(RegistrySource::new(self, config)),
         }
     }
 
     pub fn precise(&self) -> Option<&str> {
-        self.inner.precise.as_ref().map(|s| s.as_slice())
+        self.inner.precise.as_ref().map(|s| &s[..])
     }
 
     pub fn git_reference(&self) -> Option<&GitReference> {
@@ -470,9 +468,9 @@ impl<'src> Source for SourceSet<'src> {
     fn fingerprint(&self, id: &Package) -> CargoResult<String> {
         let mut ret = String::new();
         for source in self.sources.iter() {
-            ret.push_str(try!(source.fingerprint(id)).as_slice());
+            ret.push_str(&try!(source.fingerprint(id))[..]);
         }
-        return Ok(ret);
+        Ok(ret)
     }
 }
 
index cf35f1f49ddc7e06d47a537a6837d884e1672b3b..bf57298fdd111a6db74bd78ee786087a9c3ca38e 100644 (file)
@@ -1,11 +1,11 @@
 #![deny(unused)]
-#![feature(hash, os, std_misc, core, path_relative_from)]
-#![feature(io, str_words, exit_status, fs_time)]
+#![feature(os, std_misc, core, path_relative_from)]
+#![feature(io, str_words, exit_status, fs_time, convert)]
 #![cfg_attr(test, deny(warnings))]
 
 #[cfg(test)] extern crate hamcrest;
 #[macro_use] extern crate log;
-extern crate "rustc-serialize" as rustc_serialize;
+extern crate rustc_serialize;
 extern crate curl;
 extern crate docopt;
 extern crate flate2;
@@ -139,7 +139,7 @@ pub fn shell(verbose: bool) -> MultiShell {
     }
     #[cfg(windows)]
     fn isatty(fd: libc::c_int) -> bool {
-        extern crate "kernel32-sys" as kernel32;
+        extern crate kernel32_sys as kernel32;
         extern crate winapi;
         unsafe {
             let handle = kernel32::GetStdHandle(if fd == libc::STDOUT_FILENO {
@@ -224,7 +224,7 @@ fn flags_from_args<'a, T>(usage: &str, args: &[String],
 {
     let docopt = Docopt::new(usage).unwrap()
                                    .options_first(options_first)
-                                   .argv(args.iter().map(|s| s.as_slice()))
+                                   .argv(args.iter().map(|s| &s[..]))
                                    .help(true)
                                    .version(Some(version()));
     docopt.decode().map_err(|e| {
index e2aec36b4b017eab062845d57ade77c187cfa530..abe31a53a93e6049a93ede950d3cf8f390953f8e 100644 (file)
@@ -409,7 +409,7 @@ fn scrape_target_config(config: &Config, triple: &str)
                         output.library_links.extend(a.into_iter().map(|v| v.0));
                     } else if k == "rustc-link-search" {
                         output.library_paths.extend(a.into_iter().map(|v| {
-                            PathBuf::new(&v.0)
+                            PathBuf::from(&v.0)
                         }));
                     } else {
                         try!(config.expected("string", &k,
index ca2d289dd0a19ddd87fbdf08407bbc232b85f940..7eedd117e037ac8a8e3cfe10d2cf30e37afddd58 100644 (file)
@@ -22,7 +22,7 @@ pub struct NewOptions<'a> {
 
 impl Decodable for VersionControl {
     fn decode<D: Decoder>(d: &mut D) -> Result<VersionControl, D::Error> {
-        Ok(match try!(d.read_str()).as_slice() {
+        Ok(match &try!(d.read_str())[..] {
             "git" => VersionControl::Git,
             "hg" => VersionControl::Hg,
             "none" => VersionControl::NoVcs,
index 96737efa833f15311db3f1360edc4450b578eb2a..9e23fb60f2137a44eae013945b0f91f951f8d0b4 100644 (file)
@@ -51,8 +51,8 @@ impl Compilation {
         Compilation {
             libraries: HashMap::new(),
             native_dirs: HashMap::new(),  // TODO: deprecated, remove
-            root_output: PathBuf::new("/"),
-            deps_output: PathBuf::new("/"),
+            root_output: PathBuf::from("/"),
+            deps_output: PathBuf::from("/"),
             tests: Vec::new(),
             binaries: Vec::new(),
             extra_env: HashMap::new(),
index 18ce154102e818c0eb44d1da2a71f8558a913f4a..b5d0d917099220e89c6d7ea3368ee71bbd598af0 100644 (file)
@@ -69,7 +69,7 @@ impl<'a, 'b: 'a> Context<'a, 'b> {
         };
         let target_triple = target.unwrap_or(config.rustc_host()).to_string();
         let engine = build_config.exec_engine.as_ref().cloned().unwrap_or({
-            Arc::new(Box::new(ProcessEngine) as Box<ExecEngine>)
+            Arc::new(Box::new(ProcessEngine))
         });
         Ok(Context {
             target_triple: target_triple,
@@ -242,7 +242,7 @@ impl<'a, 'b: 'a> Context<'a, 'b> {
         let (triple, pair) = if kind == Kind::Host {
             (self.config.rustc_host(), &self.host_dylib)
         } else {
-            (self.target_triple.as_slice(), &self.target_dylib)
+            (&self.target_triple[..], &self.target_dylib)
         };
         match *pair {
             None => return Err(human(format!("dylib outputs are not supported \
@@ -435,12 +435,12 @@ impl<'a, 'b: 'a> Context<'a, 'b> {
 
     /// Get the user-specified linker for a particular host or target
     pub fn linker(&self, kind: Kind) -> Option<&str> {
-        self.target_config(kind).linker.as_ref().map(|s| s.as_slice())
+        self.target_config(kind).linker.as_ref().map(|s| &s[..])
     }
 
     /// Get the user-specified `ar` program for a particular host or target
     pub fn ar(&self, kind: Kind) -> Option<&str> {
-        self.target_config(kind).ar.as_ref().map(|s| s.as_slice())
+        self.target_config(kind).ar.as_ref().map(|s| &s[..])
     }
 
     /// Get the target configuration for a particular host or target
index 6e3d32711b53b419c27fe4f8995da7e984a7ba42..73e042ba0fa42521037d30a4d9ceca65f1c4091f 100644 (file)
@@ -131,7 +131,7 @@ pub fn prepare(pkg: &Package, target: &Target, req: Platform,
         {
             let build_state = build_state.outputs.lock().unwrap();
             for &(ref name, ref id) in lib_deps.iter() {
-                let data = &build_state[(id.clone(), kind)].metadata;
+                let data = &build_state[&(id.clone(), kind)].metadata;
                 for &(ref key, ref value) in data.iter() {
                     p.env(&format!("DEP_{}_{}", super::envify(name),
                                    super::envify(key)), value);
@@ -286,7 +286,7 @@ impl BuildOutput {
             } else if key == "rustc-link-lib" {
                 library_links.push(value.to_string());
             } else if key == "rustc-link-search" {
-                library_paths.push(PathBuf::new(&value));
+                library_paths.push(PathBuf::from(value));
             } else {
                 metadata.push((key.to_string(), value.to_string()))
             }
@@ -323,7 +323,7 @@ impl BuildOutput {
             };
             match flag {
                 "-l" => library_links.push(value.to_string()),
-                "-L" => library_paths.push(PathBuf::new(value)),
+                "-L" => library_paths.push(PathBuf::from(value)),
 
                 // was already checked above
                 _ => return Err(human("only -l and -L flags are allowed"))
index 542eeb1236ec6bbfeb662d7216d89b02911ad970..a048d8a66b3ef9c9c445ee4588d98e7e9fde71c3 100644 (file)
@@ -400,7 +400,7 @@ fn rustc(package: &Package, target: &Target, profile: &Profile,
                        current_id: &PackageId) {
         for id in native_lib_deps.into_iter() {
             debug!("looking up {} {:?}", id, kind);
-            let output = &build_state[(id.clone(), kind)];
+            let output = &build_state[&(id.clone(), kind)];
             for path in output.library_paths.iter() {
                 rustc.arg("-L").arg(path);
             }
@@ -456,7 +456,7 @@ fn add_plugin_deps(rustc: &mut CommandPrototype,
     let mut search_path = env::split_paths(&search_path).collect::<Vec<_>>();
     for id in plugin_deps.into_iter() {
         debug!("adding libs for plugin dep: {}", id);
-        let output = &build_state[(id, Kind::Host)];
+        let output = &build_state[&(id, Kind::Host)];
         for path in output.library_paths.iter() {
             search_path.push(path.clone());
         }
@@ -679,12 +679,12 @@ fn build_deps_args(cmd: &mut CommandPrototype,
                    -> CargoResult<()> {
     let layout = cx.layout(package, kind);
     cmd.arg("-L").arg(&{
-        let mut root = OsString::from_str("dependency=");
+        let mut root = OsString::from("dependency=");
         root.push(layout.root());
         root
     });
     cmd.arg("-L").arg(&{
-        let mut deps = OsString::from_str("dependency=");
+        let mut deps = OsString::from("dependency=");
         deps.push(layout.deps());
         deps
     });
index 2af21c2fcc86dee84dd07bc146dac30ebff238b6..41ea5ae15a54d10b43f356fc0628f81d461a1675 100644 (file)
@@ -45,7 +45,7 @@ pub fn run_tests(manifest_path: &Path,
 
         for (pkg, libs) in compile.libraries.iter() {
             for lib in libs.iter() {
-                let mut arg = OsString::from_str(pkg.name());
+                let mut arg = OsString::from(pkg.name());
                 arg.push("=");
                 arg.push(lib);
                 p.arg("--extern").arg(&arg);
index fbf3ea92df3d57a4efbf4cbcddc17efe0d60ecaf..bae8643c0e4c2a6d6ea4b0b4c56c31054ed0aa9b 100644 (file)
@@ -239,7 +239,7 @@ pub fn registry_login(config: &Config, token: String) -> CargoResult<()> {
     map.insert("token".to_string(), ConfigValue::String(token, p));
 
     config::set_config(config, Location::Global, "registry",
-                       ConfigValue::Table(map, PathBuf::new(".")))
+                       ConfigValue::Table(map, PathBuf::from(".")))
 }
 
 pub struct OwnersOptions {
@@ -269,7 +269,7 @@ pub fn modify_owners(config: &Config, opts: &OwnersOptions) -> CargoResult<()> {
 
     match opts.to_add {
         Some(ref v) => {
-            let v = v.iter().map(|s| s.as_slice()).collect::<Vec<_>>();
+            let v = v.iter().map(|s| &s[..]).collect::<Vec<_>>();
             try!(config.shell().status("Owner", format!("adding `{:#?}` to `{}`",
                                                         v, name)));
             try!(registry.add_owners(&name, &v).map_err(|e| {
@@ -281,7 +281,7 @@ pub fn modify_owners(config: &Config, opts: &OwnersOptions) -> CargoResult<()> {
 
     match opts.to_remove {
         Some(ref v) => {
-            let v = v.iter().map(|s| s.as_slice()).collect::<Vec<_>>();
+            let v = v.iter().map(|s| &s[..]).collect::<Vec<_>>();
             try!(config.shell().status("Owner", format!("removing `{:?}` from `{}`",
                                                         v, name)));
             try!(registry.remove_owners(&name, &v).map_err(|e| {
index b3fc782e53fd3c9d6f5e06877d28c33adc2918ea..c186c8e75b6c4a37dbdab7929e3cf72692c4b2e2 100644 (file)
@@ -127,7 +127,7 @@ pub fn canonicalize_url(url: &Url) -> Url {
     match url.scheme_data {
         url::SchemeData::Relative(ref mut rel) => {
             let needs_chopping = {
-                let last = rel.path.last().map(|s| s.as_slice()).unwrap_or("");
+                let last = rel.path.last().map(|s| &s[..]).unwrap_or("");
                 last.ends_with(".git")
             };
             if needs_chopping {
index cf5db84eaed473478ff95213ee82f0881004e7fb..ac4d73eac22447b832ea037769716d62f88e6462 100644 (file)
@@ -423,7 +423,7 @@ impl<'a, 'b> RegistrySource<'a, 'b> {
 
         let dep = try!(Dependency::parse(&name, Some(&req),
                                          &self.source_id));
-        let kind = match kind.as_ref().map(|s| s.as_slice()).unwrap_or("") {
+        let kind = match kind.as_ref().map(|s| &s[..]).unwrap_or("") {
             "dev" => Kind::Development,
             "build" => Kind::Build,
             _ => Kind::Normal,
index b633e93660ac38573440f02c6742522096a192e2..a6479e8183817ee66e24b83ac58252eb4a3c2840 100644 (file)
@@ -164,7 +164,7 @@ impl<'a> Config<'a> {
     }
 
     fn load_values(&self) -> CargoResult<()> {
-        let mut cfg = CV::Table(HashMap::new(), PathBuf::new("."));
+        let mut cfg = CV::Table(HashMap::new(), PathBuf::from("."));
 
         try!(walk_tree(&self.cwd, |mut file, path| {
             let mut contents = String::new();
@@ -389,7 +389,7 @@ impl ConfigValue {
 }
 
 fn homedir() -> Option<PathBuf> {
-    let cargo_home = env::var_os("CARGO_HOME").map(|p| PathBuf::new(&p));
+    let cargo_home = env::var_os("CARGO_HOME").map(PathBuf::from);
     let user_home = env::home_dir().map(|p| p.join(".cargo"));
     return cargo_home.or(user_home);
 }
index 09bbc7ffeaec3e08d607c1d920426561ca63891b..8dfa6c708811ad50637786d3b4cd01e27bc0f2bd 100644 (file)
@@ -131,7 +131,7 @@ impl<K: Dependency, V> DependencyQueue<K, V> {
             if fresh == Dirty {
                 self.dirty.insert(dep.clone());
             }
-            assert!(self.dep_map[*dep].0.remove(key));
+            assert!(self.dep_map.get_mut(dep).unwrap().0.remove(key));
         }
     }
 }
index a58bfb7b7f221a098300c24d4b64ba7a1233a99f..75bbcf10edf42cf49fd59e788be98321694ed602 100644 (file)
@@ -23,12 +23,6 @@ pub trait CargoError: Error + Send + 'static {
     fn cargo_cause(&self) -> Option<&CargoError>{ None }
 }
 
-impl fmt::Debug for Box<CargoError> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        fmt::Display::fmt(self, f)
-    }
-}
-
 impl Error for Box<CargoError> {
     fn description(&self) -> &str { (**self).description() }
     fn cause(&self) -> Option<&Error> { (**self).cause() }
@@ -47,6 +41,7 @@ pub trait ChainError<T> {
                          where E: CargoError, F: FnOnce() -> E;
 }
 
+#[derive(Debug)]
 struct ChainedError<E> {
     error: E,
     cause: Box<CargoError>,
@@ -60,6 +55,7 @@ impl<'a, T, F> ChainError<T> for F where F: FnOnce() -> CargoResult<T> {
 }
 
 impl<T, E: CargoError + 'static> ChainError<T> for Result<T, E> {
+    #[allow(trivial_casts)]
     fn chain_error<E2: 'static, C>(self, callback: C) -> CargoResult<T>
                          where E2: CargoError, C: FnOnce() -> E2 {
         self.map_err(move |err| {
@@ -77,7 +73,7 @@ impl<T> ChainError<T> for Box<CargoError> {
         Err(Box::new(ChainedError {
             error: callback(),
             cause: self,
-        }) as Box<CargoError>)
+        }))
     }
 }
 
@@ -86,7 +82,7 @@ impl<T> ChainError<T> for Option<T> {
                          where E: CargoError, C: FnOnce() -> E {
         match self {
             Some(t) => Ok(t),
-            None => Err(Box::new(callback()) as Box<CargoError>),
+            None => Err(Box::new(callback())),
         }
     }
 }
@@ -118,6 +114,7 @@ pub struct ProcessError {
 
 impl Error for ProcessError {
     fn description(&self) -> &str { &self.desc }
+    #[allow(trivial_casts)]
     fn cause(&self) -> Option<&Error> {
         self.cause.as_ref().map(|s| s as &Error)
     }
@@ -177,6 +174,7 @@ impl CargoError for ConcreteCargoError {
 // =============================================================================
 // Human errors
 
+#[derive(Debug)]
 pub struct Human<E>(pub E);
 
 impl<E: Error> Error for Human<E> {
@@ -225,7 +223,7 @@ impl CliError {
     }
 
     pub fn from_error<E: CargoError>(error: E, code: i32) -> CliError {
-        let error = Box::new(error) as Box<CargoError>;
+        let error = Box::new(error);
         CliError::from_boxed(error, code)
     }
 
@@ -355,7 +353,7 @@ pub fn caused_human<S, E>(error: S, cause: E) -> Box<CargoError>
     Box::new(ConcreteCargoError {
         description: error.to_string(),
         detail: None,
-        cause: Some(Box::new(cause) as Box<Error + Send>),
+        cause: Some(Box::new(cause)),
         is_human: true
     })
 }
index e9cdad6c447beef3e38aabde94104fd080c71982..0639b63baa58603804f54cd7f180a2b5b81532de 100644 (file)
@@ -59,7 +59,7 @@ impl<N: Eq + Hash + Clone> Graph<N> {
 
         marks.insert(node.clone(), Mark::InProgress);
 
-        for child in self.nodes[*node].iter() {
+        for child in self.nodes[node].iter() {
             self.visit(child, dst, marks);
         }
 
index 0419d602258589710a4c5d6cdca363599c0b721e..c7c749deec15016cc7f91be770b856b2c5cc8d2c 100644 (file)
@@ -35,9 +35,9 @@ pub fn normalize_path(path: &Path) -> PathBuf {
     let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek()
                                                                      .cloned() {
         components.next();
-        PathBuf::new(c.as_os_str())
+        PathBuf::from(c.as_os_str())
     } else {
-        PathBuf::new("")
+        PathBuf::new()
     };
 
     for component in components {
@@ -70,13 +70,13 @@ pub fn path2bytes(path: &Path) -> CargoResult<&[u8]> {
 pub fn bytes2path(bytes: &[u8]) -> CargoResult<PathBuf> {
     use std::os::unix::prelude::*;
     use std::ffi::OsStr;
-    Ok(PathBuf::new(<OsStr as OsStrExt>::from_bytes(bytes)))
+    Ok(PathBuf::from(OsStr::from_bytes(bytes)))
 }
 #[cfg(windows)]
 pub fn bytes2path(bytes: &[u8]) -> CargoResult<PathBuf> {
     use std::str;
     match str::from_utf8(bytes) {
-        Ok(s) => Ok(PathBuf::new(s)),
+        Ok(s) => Ok(PathBuf::from(s)),
         Err(..) => Err(human("invalid non-unicode path")),
     }
 }
index 6f12ac5ef445c78d3564c07cc8efd1b43408f763..27a043012019a1e80b21e6af812c871fb100346b 100644 (file)
@@ -69,7 +69,7 @@ mod imp {
 #[cfg(windows)]
 mod imp {
     extern crate winapi;
-    extern crate "advapi32-sys" as advapi32;
+    extern crate advapi32_sys as advapi32;
     use std::io;
     use std::ptr;
 
index debe90e37b881dd6e0b42713b635f0c2348216d2..9e3726c90cc6e1ff9209ac3917d68dc6360b01af 100644 (file)
@@ -447,7 +447,7 @@ impl TomlManifest {
         };
 
         // processing the custom build script
-        let new_build = project.build.as_ref().map(PathBuf::new);
+        let new_build = project.build.as_ref().map(PathBuf::from);
 
         // Get targets
         let targets = normalize(&lib,
@@ -573,7 +573,7 @@ fn process_dependencies<F>(cx: &mut Context,
             }
             None => {
                 details.path.as_ref().map(|path| {
-                    cx.nested_paths.push(PathBuf::new(path));
+                    cx.nested_paths.push(PathBuf::from(path));
                     cx.source_id.clone()
                 })
             }
@@ -581,7 +581,7 @@ fn process_dependencies<F>(cx: &mut Context,
 
         let dep = try!(Dependency::parse(&n,
                                          details.version.as_ref()
-                                                .map(|v| v.as_slice()),
+                                                .map(|v| &v[..]),
                                          &new_source_id));
         let dep = f(dep)
                      .set_features(details.features.unwrap_or(Vec::new()))
@@ -637,7 +637,7 @@ impl TomlTarget {
 impl PathValue {
     fn to_path(&self) -> PathBuf {
         match *self {
-            PathValue::String(ref s) => PathBuf::new(s),
+            PathValue::String(ref s) => PathBuf::from(s),
             PathValue::Path(ref p) => p.clone(),
         }
     }
index 5bb06b25ba5718819059f91e2242965083673159..e8f4d51ab2b06b055500cc5081cc069f4a9f0bee 100644 (file)
@@ -1,5 +1,5 @@
 extern crate curl;
-extern crate "rustc-serialize" as rustc_serialize;
+extern crate rustc_serialize;
 
 use std::collections::HashMap;
 use std::fmt;
index 4b542348b32074b37ad7234c6763ad3b81f9b663..ecc25693f46c895e9c50bd7d75c62097bdf0295d 100644 (file)
@@ -1 +1 @@
-2015-03-22
+2015-03-26
index ee4469eca5838ff2806933503ef032943d96782c..5f1d8026e4c6fff99a0d9b90bccc98ef210c7886 100644 (file)
@@ -1,3 +1,11 @@
+2015-03-26
+  linux-i386 d8b59fb0a0e8222b1753370f1d7c91dcb9697b37
+  linux-x86_64 e2f8388d6bccad3b3f09bbbe4ea1bc9671224f4c
+  macos-i386 3baad9c920c4a68bfd8c10ba3afb80013559adf5
+  macos-x86_64 394afa61b945717bca18412c3c93a428db7d6d5d
+  winnt-i386 4bc98dabc039c34c040942f0eadd99ddb37f06dc
+  winnt-x86_64 54d948ed95b86b9c63861246cf7cfd7161a48a20
+
 2015-03-17
   linux-i386 96a64fa9b4b6cc0cddaa90ecde4e08254c9025d5
   linux-x86_64 354bb5b11b1f19e270ebc0553db1ddc560999bdb
index af231e9dbeeb4276b2a8756c6f49360ae9e1668e..81837ff9a68d6cac29a0d4618af20f6471f2d4f2 100644 (file)
@@ -28,7 +28,7 @@ impl RepoBuilder {
 
     pub fn file(self, path: &str, contents: &str) -> RepoBuilder {
         let mut me = self.nocommit_file(path, contents);
-        me.files.push(PathBuf::new(path));
+        me.files.push(PathBuf::from(path));
         me
     }
 
index 5d347c4556c6d6eeabc5d9a8f65cffcc3c3e2ef8..a8f535c6cdf76f8b2e671a7fb9d9c5016d1819c7 100644 (file)
@@ -6,7 +6,7 @@ use std::fs;
 use std::io::prelude::*;
 use std::path::{Path, PathBuf};
 use std::process::Output;
-use std::str::{self, Str};
+use std::str;
 
 use url::Url;
 use hamcrest as ham;
@@ -138,14 +138,14 @@ impl ProjectBuilder {
         self.cargo(cmd)
     }
 
-    pub fn file<B: AsOsStr + ?Sized>(mut self, path: &B,
-                                     body: &str) -> ProjectBuilder {
+    pub fn file<B: AsRef<Path>>(mut self, path: B,
+                                body: &str) -> ProjectBuilder {
         self.files.push(FileBuilder::new(self.root.join(path), body));
         self
     }
 
-    pub fn symlink<T: AsOsStr + ?Sized>(mut self, dst: &T,
-                                        src: &T) -> ProjectBuilder {
+    pub fn symlink<T: AsRef<Path>>(mut self, dst: T,
+                                   src: T) -> ProjectBuilder {
         self.symlinks.push(SymlinkBuilder::new(self.root.join(dst),
                                                self.root.join(src)));
         self
@@ -205,15 +205,15 @@ pub fn rmdir_recursive(path: &Path) -> Result<(), String> {
                               path.display()))
 }
 
-pub fn main_file<T: Str>(println: T, deps: &[&str]) -> String {
+pub fn main_file(println: &str, deps: &[&str]) -> String {
     let mut buf = String::new();
 
     for dep in deps.iter() {
-        buf.push_str(format!("extern crate {};\n", dep).as_slice());
+        buf.push_str(&format!("extern crate {};\n", dep));
     }
 
     buf.push_str("fn main() { println!(");
-    buf.push_str(println.as_slice());
+    buf.push_str(&println);
     buf.push_str("); }\n");
 
     buf.to_string()
@@ -234,7 +234,7 @@ impl<T, E: fmt::Display> ErrMsg<T> for Result<T, E> {
 
 // Path to cargo executables
 pub fn cargo_dir() -> PathBuf {
-    env::var_os("CARGO_BIN_PATH").map(|s| PathBuf::new(&s)).or_else(|| {
+    env::var_os("CARGO_BIN_PATH").map(PathBuf::from).or_else(|| {
         env::current_exe().ok().as_ref().and_then(|s| s.parent())
             .map(|s| s.to_path_buf())
     }).unwrap_or_else(|| {
@@ -307,7 +307,7 @@ impl Execs {
 
     fn match_std(&self, expected: Option<&String>, actual: &[u8],
                  description: &str, extra: &[u8]) -> ham::MatchResult {
-        match expected.map(|s| Str::as_slice(s)) {
+        match expected.map(|s| &s[..]) {
             None => ham::success(),
             Some(out) => {
                 let actual = match str::from_utf8(actual) {
@@ -319,14 +319,14 @@ impl Execs {
                 let actual = actual.replace("\r", "");
                 let actual = actual.replace("\t", "<tab>");
 
-                let a = actual.as_slice().lines();
+                let a = actual.lines();
                 let e = out.lines();
 
                 let diffs = zip_all(a, e).enumerate();
                 let diffs = diffs.filter_map(|(i, (a,e))| {
                     match (a, e) {
                         (Some(a), Some(e)) => {
-                            if lines_match(e.as_slice(), a.as_slice()) {
+                            if lines_match(&e, &a) {
                                 None
                             } else {
                                 Some(format!("{:3} - |{}|\n    + |{}|\n", i, e, a))
@@ -416,8 +416,8 @@ impl<'a> ham::Matcher<&'a mut ProcessBuilder> for Execs {
             Err(e) => {
                 let mut s = format!("could not exec process {}: {}", process, e);
                 match e.cause() {
-                    Some(cause) => s.push_str(format!("\ncaused by: {}",
-                                                      cause.description()).as_slice()),
+                    Some(cause) => s.push_str(&format!("\ncaused by: {}",
+                                                       cause.description())),
                     None => {}
                 }
                 Err(s)
index 9cb06dfaa362895ec031851f9832aa66b2ad0286..4588bf1c64ec112fcde6637b36c7921733876050 100644 (file)
@@ -5,7 +5,7 @@ use std::path::{PathBuf, Path};
 use flate2::Compression::Default;
 use flate2::write::GzEncoder;
 use git2;
-use serialize::hex::ToHex;
+use rustc_serialize::hex::ToHex;
 use tar::Archive;
 use url::Url;
 
@@ -30,9 +30,9 @@ pub fn init() {
 
     // Init a new registry
     repo(&registry_path())
-        .file("config.json", format!(r#"
+        .file("config.json", &format!(r#"
             {{"dl":"{}","api":""}}
-        "#, dl_url()).as_slice())
+        "#, dl_url()))
         .build();
 }
 
@@ -44,17 +44,17 @@ pub fn mock_archive(name: &str, version: &str, deps: &[(&str, &str, &str)]) {
         authors = []
     "#, name, version);
     for &(dep, req, kind) in deps.iter() {
-        manifest.push_str(format!(r#"
+        manifest.push_str(&format!(r#"
             [{}dependencies.{}]
             version = "{}"
         "#, match kind {
             "build" => "build-",
             "dev" => "dev-",
             _ => ""
-        }, dep, req).as_slice());
+        }, dep, req));
     }
     let p = project(name)
-        .file("Cargo.toml", manifest.as_slice())
+        .file("Cargo.toml", &manifest)
         .file("src/lib.rs", "");
     p.build();
 
@@ -62,9 +62,9 @@ pub fn mock_archive(name: &str, version: &str, deps: &[(&str, &str, &str)]) {
     fs::create_dir_all(dst.parent().unwrap()).unwrap();
     let f = File::create(&dst).unwrap();
     let a = Archive::new(GzEncoder::new(f, Default));
-    a.append(format!("{}-{}/Cargo.toml", name, version).as_slice(),
+    a.append(&format!("{}-{}/Cargo.toml", name, version),
              &mut File::open(&p.root().join("Cargo.toml")).unwrap()).unwrap();
-    a.append(format!("{}-{}/src/lib.rs", name, version).as_slice(),
+    a.append(&format!("{}-{}/src/lib.rs", name, version),
              &mut File::open(&p.root().join("src/lib.rs")).unwrap()).unwrap();
     a.finish().unwrap();
 }
@@ -91,7 +91,7 @@ pub fn mock_pkg_yank(name: &str, version: &str, deps: &[(&str, &str, &str)],
         3 => format!("3/{}/{}", &name[..1], name),
         _ => format!("{}/{}/{}", &name[0..2], &name[2..4], name),
     };
-    publish(file.as_slice(), line.as_slice());
+    publish(&file, &line);
 }
 
 pub fn publish(file: &str, line: &str) {
index 9cfb804b93e3e866cfcce2876366edb1695c4139..7f2231f6fb0ea8797d2e88a839813becb4797c07 100644 (file)
@@ -10,8 +10,9 @@ fn setup() {}
 
 test!(cargo_bench_simple {
     let p = project("foo")
-        .file("Cargo.toml", &basic_bin_manifest("foo").as_slice())
+        .file("Cargo.toml", &basic_bin_manifest("foo"))
         .file("src/foo.rs", r#"
+            #![feature(test)]
             extern crate test;
 
             fn hello() -> &'static str {
@@ -34,7 +35,7 @@ test!(cargo_bench_simple {
                 execs().with_stdout("hello\n"));
 
     assert_that(p.cargo("bench"),
-                execs().with_stdout(format!("\
+                execs().with_stdout(&format!("\
 {} foo v0.5.0 ({})
 {} target[..]release[..]foo-[..]
 
@@ -57,9 +58,11 @@ test!(bench_tarname {
             authors = []
         "#)
         .file("benches/bin1.rs", r#"
+            #![feature(test)]
             extern crate test;
             #[bench] fn run1(_ben: &mut test::Bencher) { }"#)
         .file("benches/bin2.rs", r#"
+            #![feature(test)]
             extern crate test;
             #[bench] fn run2(_ben: &mut test::Bencher) { }"#);
 
@@ -78,20 +81,21 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
        dir = prj.url());
 
     assert_that(prj.cargo_process("bench").arg("--bench").arg("bin2"),
-        execs().with_status(0).with_stdout(expected_stdout.as_slice()));
+        execs().with_status(0).with_stdout(expected_stdout));
 });
 
 test!(cargo_bench_verbose {
     let p = project("foo")
-        .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
+        .file("Cargo.toml", &basic_bin_manifest("foo"))
         .file("src/foo.rs", r#"
+            #![feature(test)]
             extern crate test;
             fn main() {}
             #[bench] fn bench_hello(_b: &mut test::Bencher) {}
         "#);
 
     assert_that(p.cargo_process("bench").arg("-v").arg("hello"),
-        execs().with_stdout(format!("\
+        execs().with_stdout(&format!("\
 {compiling} foo v0.5.0 ({url})
 {running} `rustc src[..]foo.rs [..]`
 {running} `[..]target[..]release[..]foo-[..] hello --bench`
@@ -114,17 +118,20 @@ test!(many_similar_names {
             authors = []
         "#)
         .file("src/lib.rs", "
+            #![feature(test)]
             extern crate test;
             pub fn foo() {}
             #[bench] fn lib_bench(_b: &mut test::Bencher) {}
         ")
         .file("src/main.rs", "
+            #![feature(test)]
             extern crate foo;
             extern crate test;
             fn main() {}
             #[bench] fn bin_bench(_b: &mut test::Bencher) { foo::foo() }
         ")
         .file("benches/foo.rs", r#"
+            #![feature(test)]
             extern crate foo;
             extern crate test;
             #[bench] fn bench_bench(_b: &mut test::Bencher) { foo::foo() }
@@ -139,7 +146,7 @@ test!(many_similar_names {
 
 test!(cargo_bench_failing_test {
     let p = project("foo")
-        .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
+        .file("Cargo.toml", &basic_bin_manifest("foo"))
         .file("src/foo.rs", r#"
             #![feature(test)]
             extern crate test;
@@ -163,7 +170,7 @@ test!(cargo_bench_failing_test {
                 execs().with_stdout("hello\n"));
 
     assert_that(p.cargo("bench"),
-                execs().with_stdout(format!("\
+                execs().with_stdout(&format!("\
 {} foo v0.5.0 ({})
 {} target[..]release[..]foo-[..]
 
@@ -192,6 +199,7 @@ test!(bench_with_lib_dep {
             path = "src/main.rs"
         "#)
         .file("src/lib.rs", r#"
+            #![feature(test)]
             extern crate test;
             ///
             /// ```rust
@@ -205,6 +213,7 @@ test!(bench_with_lib_dep {
             #[bench] fn lib_bench(_b: &mut test::Bencher) {}
         "#)
         .file("src/main.rs", "
+            #![feature(test)]
             extern crate foo;
             extern crate test;
 
@@ -215,7 +224,7 @@ test!(bench_with_lib_dep {
         ");
 
     assert_that(p.cargo_process("bench"),
-        execs().with_stdout(format!("\
+        execs().with_stdout(&format!("\
 {} foo v0.0.1 ({})
 {running} target[..]release[..]baz-[..]
 
@@ -247,6 +256,7 @@ test!(bench_with_deep_lib_dep {
             path = "../foo"
         "#)
         .file("src/lib.rs", "
+            #![feature(test)]
             extern crate foo;
             extern crate test;
             #[bench]
@@ -262,6 +272,7 @@ test!(bench_with_deep_lib_dep {
             authors = []
         "#)
         .file("src/lib.rs", "
+            #![feature(test)]
             extern crate test;
 
             pub fn foo() {}
@@ -273,7 +284,7 @@ test!(bench_with_deep_lib_dep {
     p2.build();
     assert_that(p.cargo_process("bench"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {compiling} bar v0.0.1 ({dir})
 {running} target[..]
@@ -285,7 +296,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
 ",
                        compiling = COMPILING, running = RUNNING,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 });
 
 test!(external_bench_explicit {
@@ -301,6 +312,7 @@ test!(external_bench_explicit {
             path = "src/bench.rs"
         "#)
         .file("src/lib.rs", r#"
+            #![feature(test)]
             extern crate test;
             pub fn get_hello() -> &'static str { "Hello" }
 
@@ -308,6 +320,7 @@ test!(external_bench_explicit {
             fn internal_bench(_b: &mut test::Bencher) {}
         "#)
         .file("src/bench.rs", r#"
+            #![feature(test)]
             extern crate foo;
             extern crate test;
 
@@ -316,7 +329,7 @@ test!(external_bench_explicit {
         "#);
 
     assert_that(p.cargo_process("bench"),
-        execs().with_stdout(format!("\
+        execs().with_stdout(&format!("\
 {} foo v0.0.1 ({})
 {running} target[..]release[..]bench-[..]
 
@@ -345,6 +358,7 @@ test!(external_bench_implicit {
             authors = []
         "#)
         .file("src/lib.rs", r#"
+            #![feature(test)]
             extern crate test;
 
             pub fn get_hello() -> &'static str { "Hello" }
@@ -353,6 +367,7 @@ test!(external_bench_implicit {
             fn internal_bench(_b: &mut test::Bencher) {}
         "#)
         .file("benches/external.rs", r#"
+            #![feature(test)]
             extern crate foo;
             extern crate test;
 
@@ -361,7 +376,7 @@ test!(external_bench_implicit {
         "#);
 
     assert_that(p.cargo_process("bench"),
-        execs().with_stdout(format!("\
+        execs().with_stdout(&format!("\
 {} foo v0.0.1 ({})
 {running} target[..]release[..]external-[..]
 
@@ -407,6 +422,7 @@ test!(pass_through_command_line {
             authors = []
         "#)
         .file("src/lib.rs", "
+            #![feature(test)]
             extern crate test;
 
             #[bench] fn foo(_b: &mut test::Bencher) {}
@@ -415,7 +431,7 @@ test!(pass_through_command_line {
 
     assert_that(p.cargo_process("bench").arg("bar"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} target[..]release[..]foo-[..]
 
@@ -426,7 +442,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
 ",
                        compiling = COMPILING, running = RUNNING,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 
     assert_that(p.cargo("bench").arg("foo"),
                 execs().with_status(0)
@@ -445,9 +461,10 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 // tests in an rlib
 test!(cargo_bench_twice {
     let p = project("test_twice")
-        .file("Cargo.toml", basic_lib_manifest("test_twice").as_slice())
+        .file("Cargo.toml", &basic_lib_manifest("test_twice"))
         .file("src/test_twice.rs", r#"
             #![crate_type = "rlib"]
+            #![feature(test)]
 
             extern crate test;
 
@@ -477,10 +494,12 @@ test!(lib_bin_same_name {
             name = "foo"
         "#)
         .file("src/lib.rs", "
+            #![feature(test)]
             extern crate test;
             #[bench] fn lib_bench(_b: &mut test::Bencher) {}
         ")
         .file("src/main.rs", "
+            #![feature(test)]
             extern crate foo;
             extern crate test;
 
@@ -489,7 +508,7 @@ test!(lib_bin_same_name {
         ");
 
     assert_that(p.cargo_process("bench"),
-        execs().with_stdout(format!("\
+        execs().with_stdout(&format!("\
 {} foo v0.0.1 ({})
 {running} target[..]release[..]foo-[..]
 
@@ -518,6 +537,7 @@ test!(lib_with_standard_name {
             authors = []
         "#)
         .file("src/lib.rs", "
+            #![feature(test)]
             extern crate test;
 
             /// ```
@@ -529,6 +549,7 @@ test!(lib_with_standard_name {
             fn foo_bench(_b: &mut test::Bencher) {}
         ")
         .file("benches/bench.rs", "
+            #![feature(test)]
             extern crate syntax;
             extern crate test;
 
@@ -538,7 +559,7 @@ test!(lib_with_standard_name {
 
     assert_that(p.cargo_process("bench"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} syntax v0.0.1 ({dir})
 {running} target[..]release[..]bench-[..]
 
@@ -556,7 +577,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
 ",
                        compiling = COMPILING, running = RUNNING,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 });
 
 test!(lib_with_standard_name2 {
@@ -576,6 +597,7 @@ test!(lib_with_standard_name2 {
             pub fn foo() {}
         ")
         .file("src/main.rs", "
+            #![feature(test)]
             extern crate syntax;
             extern crate test;
 
@@ -587,7 +609,7 @@ test!(lib_with_standard_name2 {
 
     assert_that(p.cargo_process("bench"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} syntax v0.0.1 ({dir})
 {running} target[..]release[..]syntax-[..]
 
@@ -598,7 +620,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
 ",
                        compiling = COMPILING, running = RUNNING,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 });
 
 test!(bin_there_for_integration {
@@ -610,17 +632,19 @@ test!(bin_there_for_integration {
             authors = []
         "#)
         .file("src/main.rs", "
+            #![feature(test)]
             extern crate test;
-            fn main() { std::os::set_exit_status(1); }
+            fn main() { panic!(); }
             #[bench] fn main_bench(_b: &mut test::Bencher) {}
         ")
         .file("benches/foo.rs", r#"
+            #![feature(test)]
             extern crate test;
-            use std::old_io::Command;
+            use std::process::Command;
             #[bench]
             fn bench_bench(_b: &mut test::Bencher) {
                 let status = Command::new("target/release/foo").status().unwrap();
-                assert!(status.matches_exit_status(1));
+                assert_eq!(status.code(), Some(101));
             }
         "#);
 
@@ -650,6 +674,7 @@ test!(bench_dylib {
             path = "bar"
         "#)
         .file("src/lib.rs", r#"
+            #![feature(test)]
             extern crate "bar" as the_bar;
             extern crate test;
 
@@ -659,6 +684,7 @@ test!(bench_dylib {
             fn foo(_b: &mut test::Bencher) {}
         "#)
         .file("benches/bench.rs", r#"
+            #![feature(test)]
             extern crate "foo" as the_foo;
             extern crate test;
 
@@ -681,7 +707,7 @@ test!(bench_dylib {
 
     assert_that(p.cargo_process("bench").arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} bar v0.0.1 ({dir})
 {running} [..] -C opt-level=3 [..]
 {compiling} foo v0.0.1 ({dir})
@@ -704,11 +730,11 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
 ",
                        compiling = COMPILING, running = RUNNING,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
     p.root().move_into_the_past().unwrap();
     assert_that(p.cargo("bench").arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {fresh} bar v0.0.1 ({dir})
 {fresh} foo v0.0.1 ({dir})
 {running} [..]target[..]release[..]bench-[..]
@@ -727,7 +753,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
 ",
                        fresh = FRESH, running = RUNNING,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 });
 
 test!(bench_twice_with_build_cmd {
@@ -741,6 +767,7 @@ test!(bench_twice_with_build_cmd {
         "#)
         .file("build.rs", "fn main() {}")
         .file("src/lib.rs", "
+            #![feature(test)]
             extern crate test;
             #[bench]
             fn foo(_b: &mut test::Bencher) {}
@@ -748,7 +775,7 @@ test!(bench_twice_with_build_cmd {
 
     assert_that(p.cargo_process("bench"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} target[..]release[..]foo-[..]
 
@@ -759,11 +786,11 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 
 ",
                        compiling = COMPILING, running = RUNNING,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 
     assert_that(p.cargo("bench"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {running} target[..]release[..]foo-[..]
 
 running 1 test
@@ -790,6 +817,7 @@ test!(bench_with_examples {
             name = "testb1"
         "#)
         .file("src/lib.rs", r#"
+            #![feature(test)]
             extern crate test;
             use test::Bencher;
 
@@ -805,6 +833,7 @@ test!(bench_with_examples {
             }
         "#)
         .file("benches/testb1.rs", "
+            #![feature(test)]
             extern crate testbench;
             extern crate test;
 
@@ -826,7 +855,7 @@ test!(bench_with_examples {
 
     assert_that(p.cargo_process("bench").arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} testbench v6.6.6 ({url})
 {running} `rustc src[..]lib.rs --crate-name testbench --crate-type lib [..]`
 {running} `rustc src[..]lib.rs --crate-name testbench --crate-type lib [..]`
@@ -850,7 +879,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
                        compiling = COMPILING,
                        running = RUNNING,
                        dir = p.root().display(),
-                       url = p.url()).as_slice()));
+                       url = p.url())));
 });
 
 test!(test_a_bench {
@@ -878,7 +907,7 @@ test!(test_a_bench {
 
     assert_that(p.cargo_process("test"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.1.0 ([..])
 {running} target[..]debug[..]b-[..]
 
index ef3a940efb229dcfb987471069a84460b47b8eee..774ad6526680d00507c85358673b618be8e4fb85 100644 (file)
@@ -21,9 +21,9 @@ test!(http_auth_offered {
         let valid = ["GET", "Authorization", "Accept", "User-Agent"];
         rdr.lines().map(|s| s.unwrap())
            .take_while(|s| s.len() > 2)
-           .map(|s| s.as_slice().trim().to_string())
+           .map(|s| s.trim().to_string())
            .filter(|s| {
-               valid.iter().any(|prefix| s.as_slice().starts_with(*prefix))
+               valid.iter().any(|prefix| s.starts_with(*prefix))
             })
            .collect()
     }
@@ -78,7 +78,7 @@ test!(http_auth_offered {
     let config = paths::home().join(".gitconfig");
     let mut config = git2::Config::open(&config).unwrap();
     config.set_str("credential.helper",
-                   script.display().to_string().as_slice()).unwrap();
+                   &script.display().to_string()).unwrap();
 
     let p = project("foo")
         .file("Cargo.toml", &format!(r#"
@@ -93,13 +93,13 @@ test!(http_auth_offered {
         .file("src/main.rs", "");
 
     assert_that(p.cargo_process("build").arg("-v"),
-                execs().with_status(101).with_stdout(format!("\
+                execs().with_status(101).with_stdout(&format!("\
 {updating} git repository `http://{addr}/foo/bar`
 ",
         updating = UPDATING,
         addr = addr,
-        ).as_slice())
-                      .with_stderr(format!("\
+        ))
+                      .with_stderr(&format!("\
 Unable to update http://{addr}/foo/bar
 
 Caused by:
@@ -134,13 +134,13 @@ test!(https_something_happens {
         .file("src/main.rs", "");
 
     assert_that(p.cargo_process("build").arg("-v"),
-                execs().with_status(101).with_stdout(format!("\
+                execs().with_status(101).with_stdout(&format!("\
 {updating} git repository `https://{addr}/foo/bar`
 ",
         updating = UPDATING,
         addr = addr,
-        ).as_slice())
-                      .with_stderr(format!("\
+        ))
+                      .with_stderr(&format!("\
 Unable to update https://{addr}/foo/bar
 
 Caused by:
@@ -169,7 +169,7 @@ test!(ssh_something_happens {
     });
 
     let p = project("foo")
-        .file("Cargo.toml", format!(r#"
+        .file("Cargo.toml", &format!(r#"
             [project]
             name = "foo"
             version = "0.0.1"
@@ -177,17 +177,17 @@ test!(ssh_something_happens {
 
             [dependencies.bar]
             git = "ssh://127.0.0.1:{}/foo/bar"
-        "#, addr.port()).as_slice())
+        "#, addr.port()))
         .file("src/main.rs", "");
 
     assert_that(p.cargo_process("build").arg("-v"),
-                execs().with_status(101).with_stdout(format!("\
+                execs().with_status(101).with_stdout(&format!("\
 {updating} git repository `ssh://{addr}/foo/bar`
 ",
         updating = UPDATING,
         addr = addr,
-        ).as_slice())
-                      .with_stderr(format!("\
+        ))
+                      .with_stderr(&format!("\
 Unable to update ssh://{addr}/foo/bar
 
 Caused by:
index 3923198739db48714329773a4fa2080c452a6477..9ccd8f7314f40ba6a6aa24ffd26c30dbe411bbcb 100644 (file)
@@ -6,8 +6,8 @@ fn setup() {
 
 test!(cargo_clean_simple {
     let p = project("foo")
-              .file("Cargo.toml", &basic_bin_manifest("foo").as_slice())
-              .file("src/foo.rs", &main_file(r#""i am foo""#, &[]).as_slice());
+              .file("Cargo.toml", &basic_bin_manifest("foo"))
+              .file("src/foo.rs", &main_file(r#""i am foo""#, &[]));
 
     assert_that(p.cargo_process("build"), execs().with_status(0));
     assert_that(&p.build_dir(), existing_dir());
@@ -19,8 +19,8 @@ test!(cargo_clean_simple {
 
 test!(different_dir {
     let p = project("foo")
-              .file("Cargo.toml", &basic_bin_manifest("foo").as_slice())
-              .file("src/foo.rs", &main_file(r#""i am foo""#, &[]).as_slice())
+              .file("Cargo.toml", &basic_bin_manifest("foo"))
+              .file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
               .file("src/bar/a.rs", "");
 
     assert_that(p.cargo_process("build"), execs().with_status(0));
index e200af5bd887612ae51d7e2f13bc2d280a952a90..1efe916053176a7c77bf2de06b85c859128f1435 100644 (file)
@@ -14,8 +14,8 @@ fn setup() {
 
 test!(cargo_compile_simple {
     let p = project("foo")
-        .file("Cargo.toml", &basic_bin_manifest("foo").as_slice())
-        .file("src/foo.rs", &main_file(r#""i am foo""#, &[]).as_slice());
+        .file("Cargo.toml", &basic_bin_manifest("foo"))
+        .file("src/foo.rs", &main_file(r#""i am foo""#, &[]));
 
     assert_that(p.cargo_process("build"), execs());
     assert_that(&p.bin("foo"), existing_file());
@@ -26,8 +26,8 @@ test!(cargo_compile_simple {
 
 test!(cargo_compile_manifest_path {
     let p = project("foo")
-        .file("Cargo.toml", &basic_bin_manifest("foo").as_slice())
-        .file("src/foo.rs", &main_file(r#""i am foo""#, &[]).as_slice());
+        .file("Cargo.toml", &basic_bin_manifest("foo"))
+        .file("src/foo.rs", &main_file(r#""i am foo""#, &[]));
 
     assert_that(p.cargo_process("build")
                  .arg("--manifest-path").arg("foo/Cargo.toml")
@@ -127,7 +127,7 @@ Could not find `Cargo.toml` in `[..]` or any parent directory
 
 test!(cargo_compile_with_invalid_code {
     let p = project("foo")
-        .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
+        .file("Cargo.toml", &basic_bin_manifest("foo"))
         .file("src/foo.rs", "invalid rust code!");
 
     assert_that(p.cargo_process("build"),
@@ -158,10 +158,10 @@ test!(cargo_compile_with_invalid_code_in_deps {
         "#)
         .file("src/main.rs", "invalid rust code!");
     let bar = project("bar")
-        .file("Cargo.toml", basic_bin_manifest("bar").as_slice())
+        .file("Cargo.toml", &basic_bin_manifest("bar"))
         .file("src/lib.rs", "invalid rust code!");
     let baz = project("baz")
-        .file("Cargo.toml", basic_bin_manifest("baz").as_slice())
+        .file("Cargo.toml", &basic_bin_manifest("baz"))
         .file("src/lib.rs", "invalid rust code!");
     bar.build();
     baz.build();
@@ -170,7 +170,7 @@ test!(cargo_compile_with_invalid_code_in_deps {
 
 test!(cargo_compile_with_warnings_in_the_root_package {
     let p = project("foo")
-        .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
+        .file("Cargo.toml", &basic_bin_manifest("foo"))
         .file("src/foo.rs", "fn main() {} fn dead() {}");
 
     assert_that(p.cargo_process("build"),
@@ -202,7 +202,7 @@ test!(cargo_compile_with_warnings_in_a_dep_package {
             name = "foo"
         "#)
         .file("src/foo.rs",
-              main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
+              &main_file(r#""{}", bar::gimme()"#, &["bar"]))
         .file("bar/Cargo.toml", r#"
             [project]
 
@@ -224,7 +224,7 @@ test!(cargo_compile_with_warnings_in_a_dep_package {
 
     assert_that(p.cargo_process("build"),
         execs()
-        .with_stdout(format!("{} bar v0.5.0 ({})\n\
+        .with_stdout(&format!("{} bar v0.5.0 ({})\n\
                               {} foo v0.5.0 ({})\n",
                              COMPILING, p.url(),
                              COMPILING, p.url()))
@@ -257,7 +257,7 @@ test!(cargo_compile_with_nested_deps_inferred {
             name = "foo"
         "#)
         .file("src/foo.rs",
-              main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
+              &main_file(r#""{}", bar::gimme()"#, &["bar"]))
         .file("bar/Cargo.toml", r#"
             [project]
 
@@ -315,7 +315,7 @@ test!(cargo_compile_with_nested_deps_correct_bin {
             name = "foo"
         "#)
         .file("src/main.rs",
-              main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
+              &main_file(r#""{}", bar::gimme()"#, &["bar"]))
         .file("bar/Cargo.toml", r#"
             [project]
 
@@ -374,7 +374,7 @@ test!(cargo_compile_with_nested_deps_shorthand {
             name = "foo"
         "#)
         .file("src/foo.rs",
-              main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
+              &main_file(r#""{}", bar::gimme()"#, &["bar"]))
         .file("bar/Cargo.toml", r#"
             [project]
 
@@ -442,7 +442,7 @@ test!(cargo_compile_with_nested_deps_longhand {
             name = "foo"
         "#)
         .file("src/foo.rs",
-              main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
+              &main_file(r#""{}", bar::gimme()"#, &["bar"]))
         .file("bar/Cargo.toml", r#"
             [project]
 
@@ -509,12 +509,12 @@ test!(cargo_compile_with_dep_name_mismatch {
 
             path = "bar"
         "#)
-        .file("src/foo.rs", main_file(r#""i am foo""#, &["bar"]).as_slice())
-        .file("bar/Cargo.toml", basic_bin_manifest("bar").as_slice())
-        .file("bar/src/bar.rs", main_file(r#""i am bar""#, &[]).as_slice());
+        .file("src/foo.rs", &main_file(r#""i am foo""#, &["bar"]))
+        .file("bar/Cargo.toml", &basic_bin_manifest("bar"))
+        .file("bar/src/bar.rs", &main_file(r#""i am bar""#, &[]));
 
     assert_that(p.cargo_process("build"),
-                execs().with_status(101).with_stderr(format!(
+                execs().with_status(101).with_stderr(&format!(
 r#"no matching package named `notquitebar` found (required by `foo`)
 location searched: {proj_dir}
 version required: *
@@ -605,8 +605,8 @@ test!(crate_version_env_vars {
 
     println!("bin");
     assert_that(process(&p.bin("foo")).unwrap(),
-                execs().with_stdout(format!("0-5-1 @ alpha.1 in {}\n",
-                                            p.root().display()).as_slice()));
+                execs().with_stdout(&format!("0-5-1 @ alpha.1 in {}\n",
+                                            p.root().display())));
 
     println!("test");
     assert_that(p.cargo("test").arg("-v"),
@@ -644,8 +644,8 @@ test!(many_crate_types_old_style_lib_location {
         }
     }).collect();
     files.sort();
-    let file0 = files[0].as_slice();
-    let file1 = files[1].as_slice();
+    let file0 = &files[0];
+    let file1 = &files[1];
     println!("{} {}", file0, file1);
     assert!(file0.ends_with(".rlib") || file1.ends_with(".rlib"));
     assert!(file0.ends_with(env::consts::DLL_SUFFIX) ||
@@ -682,8 +682,8 @@ test!(many_crate_types_correct {
         }
     }).collect();
     files.sort();
-    let file0 = files[0].as_slice();
-    let file1 = files[1].as_slice();
+    let file0 = &files[0];
+    let file1 = &files[1];
     println!("{} {}", file0, file1);
     assert!(file0.ends_with(".rlib") || file1.ends_with(".rlib"));
     assert!(file0.ends_with(env::consts::DLL_SUFFIX) ||
@@ -765,8 +765,8 @@ test!(ignore_broken_symlinks {
     if cfg!(windows) { return }
 
     let p = project("foo")
-        .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
-        .file("src/foo.rs", main_file(r#""i am foo""#, &[]).as_slice())
+        .file("Cargo.toml", &basic_bin_manifest("foo"))
+        .file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
         .symlink("Notafile", "bar");
 
     assert_that(p.cargo_process("build"), execs());
@@ -810,7 +810,7 @@ test!(lto_build {
         "#)
         .file("src/main.rs", "fn main() {}");
     assert_that(p.cargo_process("build").arg("-v").arg("--release"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} test v0.0.0 ({url})
 {running} `rustc src[..]main.rs --crate-name test --crate-type bin \
         -C opt-level=3 \
@@ -838,7 +838,7 @@ test!(verbose_build {
         "#)
         .file("src/lib.rs", "");
     assert_that(p.cargo_process("build").arg("-v"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} test v0.0.0 ({url})
 {running} `rustc src[..]lib.rs --crate-name test --crate-type lib -g \
         -C metadata=[..] \
@@ -866,7 +866,7 @@ test!(verbose_release_build {
         "#)
         .file("src/lib.rs", "");
     assert_that(p.cargo_process("build").arg("-v").arg("--release"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} test v0.0.0 ({url})
 {running} `rustc src[..]lib.rs --crate-name test --crate-type lib \
         -C opt-level=3 \
@@ -910,7 +910,7 @@ test!(verbose_release_build_deps {
         "#)
         .file("foo/src/lib.rs", "");
     assert_that(p.cargo_process("build").arg("-v").arg("--release"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} foo v0.0.0 ({url})
 {running} `rustc foo[..]src[..]lib.rs --crate-name foo \
         --crate-type dylib --crate-type rlib -C prefer-dynamic \
@@ -939,7 +939,7 @@ test!(verbose_release_build_deps {
                     dir = p.root().display(),
                     url = p.url(),
                     prefix = env::consts::DLL_PREFIX,
-                    suffix = env::consts::DLL_SUFFIX).as_slice()));
+                    suffix = env::consts::DLL_SUFFIX)));
 });
 
 test!(explicit_examples {
@@ -1137,11 +1137,11 @@ test!(lib_with_standard_name {
 
     assert_that(p.cargo_process("build"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} syntax v0.0.1 ({dir})
 ",
                        compiling = COMPILING,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 });
 
 test!(simple_staticlib {
@@ -1267,7 +1267,7 @@ test!(freshness_ignores_excluded {
 
     assert_that(foo.cargo("build"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.0 ({url})
 ", compiling = COMPILING, url = foo.url())));
 
@@ -1296,11 +1296,11 @@ test!(rebuild_preserves_out_dir {
         "#)
         .file("build.rs", r#"
             use std::env;
-            use std::old_io::File;
-            use std::old_path::{Path, GenericPath};
+            use std::fs::File;
+            use std::path::Path;
 
             fn main() {
-                let path = Path::new(env::var("OUT_DIR").unwrap()).join("foo");
+                let path = Path::new(&env::var("OUT_DIR").unwrap()).join("foo");
                 if env::var_os("FIRST").is_some() {
                     File::create(&path).unwrap();
                 } else {
@@ -1314,14 +1314,14 @@ test!(rebuild_preserves_out_dir {
 
     assert_that(foo.cargo("build").env("FIRST", "1"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.0 ({url})
 ", compiling = COMPILING, url = foo.url())));
 
     File::create(&foo.root().join("src/bar.rs")).unwrap();
     assert_that(foo.cargo("build"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.0 ({url})
 ", compiling = COMPILING, url = foo.url())));
 });
@@ -1434,7 +1434,7 @@ test!(cargo_platform_specific_dependency {
             path = "bar"
         "#)
         .file("src/main.rs",
-              main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
+              &main_file(r#""{}", bar::gimme()"#, &["bar"]))
         .file("bar/Cargo.toml", r#"
             [project]
 
@@ -1474,7 +1474,7 @@ test!(cargo_platform_specific_dependency {
             path = "bar"
         "#)
         .file("src/main.rs",
-              main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
+              &main_file(r#""{}", bar::gimme()"#, &["bar"]))
         .file("bar/Cargo.toml", r#"
             [project]
 
index 093942e866fd6a50c6a9f85b0efa54cd9b321def..ff10b24de475e236a91157c6cb9113f51d7ec7e0 100644 (file)
@@ -31,13 +31,13 @@ test!(custom_build_script_failed {
         "#);
     assert_that(p.cargo_process("build").arg("-v"),
                 execs().with_status(101)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.5.0 ({url})
 {running} `rustc build.rs --crate-name build_script_build --crate-type bin [..]`
 {running} `[..]build-script-build[..]`
 ",
 url = p.url(), compiling = COMPILING, running = RUNNING))
-                       .with_stderr(format!("\
+                       .with_stderr(&format!("\
 failed to run custom build command for `foo v0.5.0 ({})`
 Process didn't exit successfully: `[..]build[..]build-script-build[..]` \
     (exit code: 101)",
@@ -81,6 +81,7 @@ test!(custom_build_env_vars {
             use std::env;
             use std::io::prelude::*;
             use std::path::Path;
+            use std::fs;
 
             fn main() {{
                 let _target = env::var("TARGET").unwrap();
@@ -98,7 +99,7 @@ test!(custom_build_env_vars {
 
                 let out = env::var("OUT_DIR").unwrap();
                 assert!(out.starts_with(r"{0}"));
-                assert!(Path::new(&out).is_dir());
+                assert_eq!(fs::metadata(&out).map(|m| m.is_dir()), Ok(true));
 
                 let _host = env::var("HOST").unwrap();
 
@@ -135,7 +136,7 @@ test!(custom_build_script_wrong_rustc_flags {
 
     assert_that(p.cargo_process("build"),
                 execs().with_status(101)
-                       .with_stderr(format!("\
+                       .with_stderr(&format!("\
 Only `-l` and `-L` flags are allowed in build script of `foo v0.5.0 ({})`: \
 `-aaa -bbb`",
 p.url())));
@@ -176,7 +177,7 @@ test!(custom_build_script_rustc_flags {
     // TODO: TEST FAILS BECAUSE OF WRONG STDOUT (but otherwise, the build works)
     assert_that(p.cargo_process("build").arg("--verbose"),
                 execs().with_status(101)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} bar v0.5.0 ({url})
 {running} `rustc {dir}{sep}src{sep}lib.rs --crate-name test --crate-type lib -g \
         -C metadata=[..] \
@@ -267,16 +268,16 @@ test!(overrides_and_links {
         .file("build.rs", r#"
             use std::env;
             fn main() {
-                assert_eq!(env::var("DEP_FOO_FOO").unwrap().as_slice(), "bar");
-                assert_eq!(env::var("DEP_FOO_BAR").unwrap().as_slice(), "baz");
+                assert_eq!(env::var("DEP_FOO_FOO").unwrap(), "bar");
+                assert_eq!(env::var("DEP_FOO_BAR").unwrap(), "baz");
             }
         "#)
-        .file(".cargo/config", format!(r#"
+        .file(".cargo/config", &format!(r#"
             [target.{}.foo]
             rustc-flags = "-L foo -L bar"
             foo = "bar"
             bar = "baz"
-        "#, target).as_slice())
+        "#, target))
         .file("a/Cargo.toml", r#"
             [project]
             name = "a"
@@ -290,14 +291,14 @@ test!(overrides_and_links {
 
     assert_that(p.cargo_process("build").arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 [..]
 [..]
 [..]
 [..]
 [..]
 {running} `rustc [..] --crate-name foo [..] -L foo -L bar[..]`
-", running = RUNNING).as_slice()));
+", running = RUNNING)));
 });
 
 test!(unused_overrides {
@@ -313,12 +314,12 @@ test!(unused_overrides {
         "#)
         .file("src/lib.rs", "")
         .file("build.rs", "fn main() {}")
-        .file(".cargo/config", format!(r#"
+        .file(".cargo/config", &format!(r#"
             [target.{}.foo]
             rustc-flags = "-L foo -L bar"
             foo = "bar"
             bar = "baz"
-        "#, target).as_slice());
+        "#, target));
 
     assert_that(p.cargo_process("build").arg("-v"),
                 execs().with_status(0));
@@ -340,8 +341,8 @@ test!(links_passes_env_vars {
         .file("build.rs", r#"
             use std::env;
             fn main() {
-                assert_eq!(env::var("DEP_FOO_FOO").unwrap().as_slice(), "bar");
-                assert_eq!(env::var("DEP_FOO_BAR").unwrap().as_slice(), "baz");
+                assert_eq!(env::var("DEP_FOO_FOO").unwrap(), "bar");
+                assert_eq!(env::var("DEP_FOO_BAR").unwrap(), "baz");
             }
         "#)
         .file("a/Cargo.toml", r#"
@@ -362,7 +363,7 @@ test!(links_passes_env_vars {
 
     assert_that(p.cargo_process("build").arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} [..] v0.5.0 (file://[..])
 {running} `rustc [..]build.rs [..]`
 {compiling} [..] v0.5.0 (file://[..])
@@ -371,7 +372,7 @@ test!(links_passes_env_vars {
 {running} `[..]`
 {running} `[..]`
 {running} `rustc [..] --crate-name foo [..]`
-", compiling = COMPILING, running = RUNNING).as_slice()));
+", compiling = COMPILING, running = RUNNING)));
 });
 
 test!(only_rerun_build_script {
@@ -397,11 +398,11 @@ test!(only_rerun_build_script {
 
     assert_that(p.cargo("build").arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.5.0 (file://[..])
 {running} `[..]build-script-build[..]`
 {running} `rustc [..] --crate-name foo [..]`
-", compiling = COMPILING, running = RUNNING).as_slice()));
+", compiling = COMPILING, running = RUNNING)));
 });
 
 test!(rebuild_continues_to_pass_env_vars {
@@ -439,8 +440,8 @@ test!(rebuild_continues_to_pass_env_vars {
         .file("build.rs", r#"
             use std::env;
             fn main() {
-                assert_eq!(env::var("DEP_FOO_FOO").unwrap().as_slice(), "bar");
-                assert_eq!(env::var("DEP_FOO_BAR").unwrap().as_slice(), "baz");
+                assert_eq!(env::var("DEP_FOO_FOO").unwrap(), "bar");
+                assert_eq!(env::var("DEP_FOO_BAR").unwrap(), "baz");
             }
         "#);
 
@@ -480,7 +481,7 @@ test!(testing_and_such {
     println!("test");
     assert_that(p.cargo("test").arg("-vj1"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.5.0 (file://[..])
 {running} `[..]build-script-build[..]`
 {running} `rustc [..] --crate-name foo [..]`
@@ -498,25 +499,25 @@ running 0 tests
 
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
 
-", compiling = COMPILING, running = RUNNING, doctest = DOCTEST).as_slice()));
+", compiling = COMPILING, running = RUNNING, doctest = DOCTEST)));
 
     println!("doc");
     assert_that(p.cargo("doc").arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.5.0 (file://[..])
 {running} `rustdoc [..]`
-", compiling = COMPILING, running = RUNNING).as_slice()));
+", compiling = COMPILING, running = RUNNING)));
 
     File::create(&p.root().join("src/main.rs")).unwrap()
          .write_all(b"fn main() {}").unwrap();
     println!("run");
     assert_that(p.cargo("run"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.5.0 (file://[..])
 {running} `target[..]foo[..]`
-", compiling = COMPILING, running = RUNNING).as_slice()));
+", compiling = COMPILING, running = RUNNING)));
 });
 
 test!(propagation_of_l_flags {
@@ -558,14 +559,14 @@ test!(propagation_of_l_flags {
         "#)
         .file("b/src/lib.rs", "")
         .file("b/build.rs", "bad file")
-        .file(".cargo/config", format!(r#"
+        .file(".cargo/config", &format!(r#"
             [target.{}.foo]
             rustc-flags = "-L foo"
-        "#, target).as_slice());
+        "#, target));
 
     assert_that(p.cargo_process("build").arg("-v").arg("-j1"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 [..]
 [..]
 [..]
@@ -574,7 +575,7 @@ test!(propagation_of_l_flags {
 {running} `rustc [..] --crate-name a [..]-L bar[..]-L foo[..]`
 {compiling} foo v0.5.0 (file://[..])
 {running} `rustc [..] --crate-name foo [..] -L bar -L foo`
-", compiling = COMPILING, running = RUNNING).as_slice()));
+", compiling = COMPILING, running = RUNNING)));
 });
 
 test!(propagation_of_l_flags_new {
@@ -616,14 +617,14 @@ test!(propagation_of_l_flags_new {
         "#)
         .file("b/src/lib.rs", "")
         .file("b/build.rs", "bad file")
-        .file(".cargo/config", format!(r#"
+        .file(".cargo/config", &format!(r#"
             [target.{}.foo]
             rustc-link-search = ["foo"]
-        "#, target).as_slice());
+        "#, target));
 
     assert_that(p.cargo_process("build").arg("-v").arg("-j1"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 [..]
 [..]
 [..]
@@ -632,7 +633,7 @@ test!(propagation_of_l_flags_new {
 {running} `rustc [..] --crate-name a [..]-L bar[..]-L foo[..]`
 {compiling} foo v0.5.0 (file://[..])
 {running} `rustc [..] --crate-name foo [..] -L bar -L foo`
-", compiling = COMPILING, running = RUNNING).as_slice()));
+", compiling = COMPILING, running = RUNNING)));
 });
 
 test!(build_deps_simple {
@@ -661,14 +662,14 @@ test!(build_deps_simple {
 
     assert_that(p.cargo_process("build").arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} a v0.5.0 (file://[..])
 {running} `rustc [..] --crate-name a [..]`
 {compiling} foo v0.5.0 (file://[..])
 {running} `rustc build.rs [..] --extern a=[..]`
 {running} `[..]foo-[..]build-script-build[..]`
 {running} `rustc [..] --crate-name foo [..]`
-", compiling = COMPILING, running = RUNNING).as_slice()));
+", compiling = COMPILING, running = RUNNING)));
 });
 
 test!(build_deps_not_for_normal {
@@ -749,7 +750,7 @@ test!(build_cmd_with_a_build_cmd {
 
     assert_that(p.cargo_process("build").arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} b v0.5.0 (file://[..])
 {running} `rustc [..] --crate-name b [..]`
 {compiling} a v0.5.0 (file://[..])
@@ -770,7 +771,7 @@ test!(build_cmd_with_a_build_cmd {
     -C metadata=[..] -C extra-filename=-[..] \
     --out-dir [..]target[..]debug --emit=dep-info,link \
     -L [..]target[..]debug -L [..]target[..]deps`
-", compiling = COMPILING, running = RUNNING).as_slice()));
+", compiling = COMPILING, running = RUNNING)));
 });
 
 test!(out_dir_is_preserved {
@@ -785,11 +786,11 @@ test!(out_dir_is_preserved {
         .file("src/lib.rs", "")
         .file("build.rs", r#"
             use std::env;
-            use std::old_io::File;
-            use std::old_path::{Path, GenericPath};
+            use std::fs::File;
+            use std::path::Path;
             fn main() {
                 let out = env::var("OUT_DIR").unwrap();
-                File::create(&Path::new(out).join("foo")).unwrap();
+                File::create(Path::new(&out).join("foo")).unwrap();
             }
         "#);
 
@@ -804,7 +805,7 @@ test!(out_dir_is_preserved {
         use std::old_io::File;
         fn main() {
             let out = env::var("OUT_DIR").unwrap();
-            File::open(&Path::new(out).join("foo")).unwrap();
+            File::open(&Path::new(&out).join("foo")).unwrap();
         }
     "#).unwrap();
     p.root().move_into_the_past().unwrap();
@@ -839,12 +840,12 @@ test!(output_separate_lines {
         "#);
     assert_that(p.cargo_process("build").arg("-v"),
                 execs().with_status(101)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.5.0 (file://[..])
 {running} `rustc build.rs [..]`
 {running} `[..]foo-[..]build-script-build[..]`
 {running} `rustc [..] --crate-name foo [..] -L foo -l foo:static`
-", compiling = COMPILING, running = RUNNING).as_slice()));
+", compiling = COMPILING, running = RUNNING)));
 });
 
 test!(output_separate_lines_new {
@@ -865,12 +866,12 @@ test!(output_separate_lines_new {
         "#);
     assert_that(p.cargo_process("build").arg("-v"),
                 execs().with_status(101)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.5.0 (file://[..])
 {running} `rustc build.rs [..]`
 {running} `[..]foo-[..]build-script-build[..]`
 {running} `rustc [..] --crate-name foo [..] -L foo -l static=foo`
-", compiling = COMPILING, running = RUNNING).as_slice()));
+", compiling = COMPILING, running = RUNNING)));
 });
 
 #[cfg(not(windows))] // FIXME(#867)
@@ -891,14 +892,16 @@ test!(code_generation {
             }
         "#)
         .file("build.rs", r#"
+            #![feature(convert)]
             use std::env;
-            use std::old_io::{File, Writer};
-            use std::old_path::{Path, GenericPath};
+            use std::fs::File;
+            use std::io::prelude::*;
+            use std::path::PathBuf;
 
             fn main() {
-                let dst = Path::new(env::var("OUT_DIR").unwrap());
+                let dst = PathBuf::from(env::var("OUT_DIR").unwrap());
                 let mut f = File::create(&dst.join("hello.rs")).unwrap();
-                f.write_str("
+                f.write_all(b"
                     pub fn message() -> &'static str {
                         \"Hello, World!\"
                     }
@@ -907,11 +910,11 @@ test!(code_generation {
         "#);
     assert_that(p.cargo_process("run"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.5.0 (file://[..])
 {running} `target[..]foo`
 Hello, World!
-", compiling = COMPILING, running = RUNNING).as_slice()));
+", compiling = COMPILING, running = RUNNING)));
 
     assert_that(p.cargo_process("test"),
                 execs().with_status(0));
@@ -1056,13 +1059,15 @@ test!(test_a_lib_with_a_build_command {
             }
         "#)
         .file("build.rs", r#"
+            #![feature(convert)]
             use std::env;
-            use std::old_io::{File, Writer};
-            use std::old_path::{Path, GenericPath};
+            use std::io::prelude::*;
+            use std::fs::File;
+            use std::path::PathBuf;
 
             fn main() {
-                let out = Path::new(env::var("OUT_DIR").unwrap());
-                File::create(&out.join("foo.rs")).write_str("
+                let out = PathBuf::from(env::var("OUT_DIR").unwrap());
+                File::create(out.join("foo.rs")).unwrap().write_all(b"
                     fn foo() -> i32 { 1 }
                 ").unwrap();
             }
@@ -1148,12 +1153,14 @@ test!(build_script_with_dynamic_native_dependency {
             build = "build.rs"
         "#)
         .file("bar/build.rs", r#"
+            #![feature(convert)]
             use std::env;
-            use std::old_path::{Path, GenericPath};
+            use std::path::PathBuf;
 
             fn main() {
-                let src = Path::new(env::var("SRC").unwrap());
-                println!("cargo:rustc-flags=-L {}", src.dir_path().display());
+                let src = PathBuf::from(env::var("SRC").unwrap());
+                println!("cargo:rustc-flags=-L {}", src.parent().unwrap()
+                                                       .display());
             }
         "#)
         .file("bar/src/lib.rs", &format!(r#"
index c8696efd09799ebc739373583e2aeab0628a1cfb..f1ce6ec0079e2114b6a4dbab592937d0733d78cb 100644 (file)
@@ -121,7 +121,7 @@ test!(cargo_compile_simple_git_dep {
 
     assert_that(project.cargo_process("build"),
         execs()
-        .with_stdout(format!("{} git repository `{}`\n\
+        .with_stdout(&format!("{} git repository `{}`\n\
                               {} dep1 v0.5.0 ({}#[..])\n\
                               {} foo v0.5.0 ({})\n",
                              UPDATING, path2url(git_root.clone()),
@@ -188,7 +188,7 @@ test!(cargo_compile_git_dep_branch {
 
     assert_that(project.cargo_process("build"),
         execs()
-        .with_stdout(format!("{} git repository `{}`\n\
+        .with_stdout(&format!("{} git repository `{}`\n\
                               {} dep1 v0.5.0 ({}?branch=branchy#[..])\n\
                               {} foo v0.5.0 ({})\n",
                              UPDATING, path2url(git_root.clone()),
@@ -258,7 +258,7 @@ test!(cargo_compile_git_dep_tag {
 
     assert_that(project.cargo_process("build"),
         execs()
-        .with_stdout(format!("{} git repository `{}`\n\
+        .with_stdout(&format!("{} git repository `{}`\n\
                               {} dep1 v0.5.0 ({}?tag=v0.1.0#[..])\n\
                               {} foo v0.5.0 ({})\n",
                              UPDATING, path2url(git_root.clone()),
@@ -336,7 +336,7 @@ test!(cargo_compile_with_nested_paths {
             name = "parent"
         "#, git_project.url()))
         .file("src/parent.rs",
-              main_file(r#""{}", dep1::hello()"#, &["dep1"]).as_slice());
+              &main_file(r#""{}", dep1::hello()"#, &["dep1"]));
 
     p.cargo_process("build")
         .exec_with_output()
@@ -408,7 +408,7 @@ test!(cargo_compile_with_meta_package {
             name = "parent"
         "#, git_project.url(), git_project.url()))
         .file("src/parent.rs",
-              main_file(r#""{} {}", dep1::hello(), dep2::hello()"#, &["dep1", "dep2"]).as_slice());
+              &main_file(r#""{} {}", dep1::hello(), dep2::hello()"#, &["dep1", "dep2"]));
 
     p.cargo_process("build")
         .exec_with_output()
@@ -444,7 +444,7 @@ test!(cargo_compile_with_short_ssh_git {
     assert_that(project.cargo_process("build"),
         execs()
         .with_stdout("")
-        .with_stderr(format!("\
+        .with_stderr(&format!("\
 failed to parse manifest at `[..]`
 
 Caused by:
@@ -486,7 +486,7 @@ test!(two_revs_same_deps {
 
             [dependencies.baz]
             path = "../baz"
-        "#, bar.url(), rev1).as_slice())
+        "#, bar.url(), rev1))
         .file("src/main.rs", r#"
             extern crate bar;
             extern crate baz;
@@ -507,7 +507,7 @@ test!(two_revs_same_deps {
             [dependencies.bar]
             git = '{}'
             rev = "{}"
-        "#, bar.url(), rev2).as_slice())
+        "#, bar.url(), rev2))
         .file("src/lib.rs", r#"
             extern crate bar;
             pub fn baz() -> i32 { bar::bar() }
@@ -557,11 +557,11 @@ test!(recompilation {
             name = "foo"
         "#, git_project.url()))
         .file("src/foo.rs",
-              main_file(r#""{:?}", bar::bar()"#, &["bar"]).as_slice());
+              &main_file(r#""{:?}", bar::bar()"#, &["bar"]));
 
     // First time around we should compile both foo and bar
     assert_that(p.cargo_process("build"),
-                execs().with_stdout(format!("{} git repository `{}`\n\
+                execs().with_stdout(&format!("{} git repository `{}`\n\
                                              {} bar v0.5.0 ({}#[..])\n\
                                              {} foo v0.5.0 ({})\n",
                                             UPDATING, git_project.url(),
@@ -581,7 +581,7 @@ test!(recompilation {
                 execs().with_stdout(""));
 
     assert_that(p.cargo("update"),
-                execs().with_stdout(format!("{} git repository `{}`",
+                execs().with_stdout(&format!("{} git repository `{}`",
                                             UPDATING,
                                             git_project.url())));
 
@@ -601,12 +601,12 @@ test!(recompilation {
 
     // Update the dependency and carry on!
     assert_that(p.cargo("update"),
-                execs().with_stdout(format!("{} git repository `{}`",
+                execs().with_stdout(&format!("{} git repository `{}`",
                                             UPDATING,
                                             git_project.url())));
     println!("going for the last compile");
     assert_that(p.cargo("build"),
-                execs().with_stdout(format!("{} bar v0.5.0 ({}#[..])\n\
+                execs().with_stdout(&format!("{} bar v0.5.0 ({}#[..])\n\
                                              {} foo v0.5.0 ({})\n",
                                             COMPILING, git_project.url(),
                                             COMPILING, p.url())));
@@ -616,7 +616,7 @@ test!(recompilation {
                  .arg("-p").arg("foo"),
                 execs().with_stdout(""));
     assert_that(p.cargo("build"),
-                execs().with_stdout(format!("{} foo v0.5.0 ({})\n",
+                execs().with_stdout(&format!("{} foo v0.5.0 ({})\n",
                                             COMPILING, p.url())));
 });
 
@@ -680,7 +680,7 @@ test!(update_with_shared_deps {
 
     // First time around we should compile both foo and bar
     assert_that(p.cargo_process("build"),
-                execs().with_stdout(format!("\
+                execs().with_stdout(&format!("\
 {updating} git repository `{git}`
 {compiling} bar v0.5.0 ({git}#[..])
 {compiling} [..] v0.5.0 ({dir})
@@ -719,14 +719,14 @@ test!(update_with_shared_deps {
     assert_that(p.cargo("update")
                  .arg("-p").arg("dep1")
                  .arg("--aggressive"),
-                execs().with_stdout(format!("{} git repository `{}`",
+                execs().with_stdout(&format!("{} git repository `{}`",
                                             UPDATING,
                                             git_project.url())));
 
     // Make sure we still only compile one version of the git repo
     println!("build");
     assert_that(p.cargo("build"),
-                execs().with_stdout(format!("\
+                execs().with_stdout(&format!("\
 {compiling} bar v0.5.0 ({git}#[..])
 {compiling} [..] v0.5.0 ({dir})
 {compiling} [..] v0.5.0 ({dir})
@@ -736,7 +736,7 @@ test!(update_with_shared_deps {
 
     // We should be able to update transitive deps
     assert_that(p.cargo("update").arg("-p").arg("bar"),
-                execs().with_stdout(format!("{} git repository `{}`",
+                execs().with_stdout(&format!("{} git repository `{}`",
                                             UPDATING,
                                             git_project.url())));
 });
@@ -822,7 +822,7 @@ test!(two_deps_only_update_one {
 
     assert_that(project.cargo_process("build"),
         execs()
-        .with_stdout(format!("{} git repository `[..]`\n\
+        .with_stdout(&format!("{} git repository `[..]`\n\
                               {} git repository `[..]`\n\
                               {} [..] v0.5.0 ([..])\n\
                               {} [..] v0.5.0 ([..])\n\
@@ -844,7 +844,7 @@ test!(two_deps_only_update_one {
     assert_that(project.cargo("update")
                        .arg("-p").arg("dep1"),
         execs()
-        .with_stdout(format!("{} git repository `{}`\n",
+        .with_stdout(&format!("{} git repository `{}`\n",
                              UPDATING, git1.url()))
         .with_stderr(""));
 });
@@ -911,7 +911,7 @@ test!(stale_cached_version {
     // Now build!
     assert_that(foo.cargo("build"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {updating} git repository `{bar}`
 {compiling} bar v0.0.0 ({bar}#[..])
 {compiling} foo v0.0.0 ({foo})
@@ -942,7 +942,7 @@ test!(dep_with_changed_submodule {
     }).unwrap();
 
     let repo = git2::Repository::open(&git_project.root()).unwrap();
-    let mut sub = add_submodule(&repo, git_project2.url().to_string().as_slice(),
+    let mut sub = add_submodule(&repo, &git_project2.url().to_string(),
                                 &Path::new("src"));
     commit(&repo);
 
@@ -962,7 +962,7 @@ test!(dep_with_changed_submodule {
 
     println!("first run");
     assert_that(project.cargo_process("run"), execs()
-                .with_stdout(format!("{} git repository `[..]`\n\
+                .with_stdout(&format!("{} git repository `[..]`\n\
                                       {} dep1 v0.5.0 ([..])\n\
                                       {} foo v0.5.0 ([..])\n\
                                       {} `target[..]foo[..]`\n\
@@ -984,7 +984,7 @@ test!(dep_with_changed_submodule {
     {
         let subrepo = sub.open().unwrap();
         let mut origin = subrepo.find_remote("origin").unwrap();
-        origin.set_url(git_project3.url().to_string().as_slice()).unwrap();
+        origin.set_url(&git_project3.url().to_string()).unwrap();
         origin.add_fetch("refs/heads/*:refs/heads/*").unwrap();;
         origin.fetch(&[], None).unwrap();
         origin.save().unwrap();
@@ -1002,13 +1002,13 @@ test!(dep_with_changed_submodule {
     assert_that(project.cargo("update").arg("-v"),
                 execs()
                 .with_stderr("")
-                .with_stdout(format!("{} git repository `{}`",
+                .with_stdout(&format!("{} git repository `{}`",
                                      UPDATING,
                                      git_project.url())));
 
     println!("last run");
     assert_that(project.cargo("run"), execs()
-                .with_stdout(format!("{compiling} dep1 v0.5.0 ([..])\n\
+                .with_stdout(&format!("{compiling} dep1 v0.5.0 ([..])\n\
                                       {compiling} foo v0.5.0 ([..])\n\
                                       {running} `target[..]foo[..]`\n\
                                       project3\
@@ -1042,7 +1042,7 @@ test!(dev_deps_with_testing {
             [dev-dependencies.bar]
             version = "0.5.0"
             git = '{}'
-        "#, p2.url()).as_slice())
+        "#, p2.url()))
         .file("src/main.rs", r#"
             fn main() {}
 
@@ -1056,7 +1056,7 @@ test!(dev_deps_with_testing {
     // Generate a lockfile which did not use `bar` to compile, but had to update
     // `bar` to generate the lockfile
     assert_that(p.cargo_process("build"),
-        execs().with_stdout(format!("\
+        execs().with_stdout(&format!("\
 {updating} git repository `{bar}`
 {compiling} foo v0.5.0 ({url})
 ", updating = UPDATING, compiling = COMPILING, url = p.url(), bar = p2.url())));
@@ -1064,7 +1064,7 @@ test!(dev_deps_with_testing {
     // Make sure we use the previous resolution of `bar` instead of updating it
     // a second time.
     assert_that(p.cargo("test"),
-        execs().with_stdout(format!("\
+        execs().with_stdout(&format!("\
 {compiling} [..] v0.5.0 ([..])
 {compiling} [..] v0.5.0 ([..]
 {running} target[..]foo-[..]
@@ -1098,7 +1098,7 @@ test!(git_build_cmd_freshness {
 
     assert_that(foo.cargo("build"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.0 ({url})
 ", compiling = COMPILING, url = foo.url())));
 
@@ -1143,13 +1143,13 @@ test!(git_name_not_always_needed {
 
             [dev-dependencies.bar]
             git = '{}'
-        "#, p2.url()).as_slice())
+        "#, p2.url()))
         .file("src/main.rs", "fn main() {}");
 
     // Generate a lockfile which did not use `bar` to compile, but had to update
     // `bar` to generate the lockfile
     assert_that(p.cargo_process("build"),
-        execs().with_stdout(format!("\
+        execs().with_stdout(&format!("\
 {updating} git repository `{bar}`
 {compiling} foo v0.5.0 ({url})
 ", updating = UPDATING, compiling = COMPILING, url = p.url(), bar = p2.url())));
@@ -1176,13 +1176,13 @@ test!(git_repo_changing_no_rebuild {
             build = 'build.rs'
             [dependencies.bar]
             git = '{}'
-        "#, bar.url()).as_slice())
+        "#, bar.url()))
         .file("src/main.rs", "fn main() {}")
         .file("build.rs", "fn main() {}");
     p1.build();
     p1.root().move_into_the_past().unwrap();
     assert_that(p1.cargo("build"),
-                execs().with_stdout(format!("\
+                execs().with_stdout(&format!("\
 {updating} git repository `{bar}`
 {compiling} [..]
 {compiling} [..]
@@ -1205,10 +1205,10 @@ test!(git_repo_changing_no_rebuild {
             authors = []
             [dependencies.bar]
             git = '{}'
-        "#, bar.url()).as_slice())
+        "#, bar.url()))
         .file("src/main.rs", "fn main() {}");
     assert_that(p2.cargo_process("build"),
-                execs().with_stdout(format!("\
+                execs().with_stdout(&format!("\
 {updating} git repository `{bar}`
 {compiling} [..]
 {compiling} [..]
@@ -1239,7 +1239,7 @@ test!(git_dep_build_cmd {
             name = "foo"
         "#)
         .file("src/foo.rs",
-              main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
+              &main_file(r#""{}", bar::gimme()"#, &["bar"]))
         .file("bar/Cargo.toml", r#"
             [project]
 
@@ -1256,11 +1256,9 @@ test!(git_dep_build_cmd {
             pub fn gimme() -> i32 { 0 }
         "#)
         .file("bar/build.rs", r#"
-            use std::old_io::fs;
-            use std::old_path::{Path, GenericPath};
+            use std::fs;
             fn main() {
-                fs::copy(&Path::new("src/bar.rs.in"),
-                         &Path::new("src/bar.rs")).unwrap();
+                fs::copy("src/bar.rs.in", "src/bar.rs").unwrap();
             }
         "#)
     }).unwrap();
@@ -1303,10 +1301,10 @@ test!(fetch_downloads {
             authors = []
             [dependencies.bar]
             git = '{}'
-        "#, bar.url()).as_slice())
+        "#, bar.url()))
         .file("src/main.rs", "fn main() {}");
     assert_that(p.cargo_process("fetch"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} git repository `{url}`
 ", updating = UPDATING, url = bar.url())));
 
@@ -1333,12 +1331,12 @@ test!(warnings_in_git_dep {
             authors = []
             [dependencies.bar]
             git = '{}'
-        "#, bar.url()).as_slice())
+        "#, bar.url()))
         .file("src/main.rs", "fn main() {}");
 
     assert_that(p.cargo_process("build"),
         execs()
-        .with_stdout(format!("{} git repository `{}`\n\
+        .with_stdout(&format!("{} git repository `{}`\n\
                               {} bar v0.5.0 ({}#[..])\n\
                               {} foo v0.5.0 ({})\n",
                              UPDATING, bar.url(),
@@ -1375,7 +1373,7 @@ test!(update_ambiguous {
 
             [dependencies.foo]
             git = '{}'
-        "#, foo2.url()).as_slice())
+        "#, foo2.url()))
         .file("src/lib.rs", "")
     }).unwrap();
 
@@ -1389,7 +1387,7 @@ test!(update_ambiguous {
             git = '{}'
             [dependencies.bar]
             git = '{}'
-        "#, foo1.url(), bar.url()).as_slice())
+        "#, foo1.url(), bar.url()))
         .file("src/main.rs", "fn main() {}");
 
     assert_that(p.cargo_process("generate-lockfile"), execs().with_status(0));
@@ -1434,14 +1432,14 @@ test!(update_one_dep_in_repo_with_many_deps {
             git = '{}'
             [dependencies.a]
             git = '{}'
-        "#, foo.url(), foo.url()).as_slice())
+        "#, foo.url(), foo.url()))
         .file("src/main.rs", "fn main() {}");
 
     assert_that(p.cargo_process("generate-lockfile"), execs().with_status(0));
     assert_that(p.cargo("update")
                  .arg("-p").arg("foo"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 Updating git repository `{}`
 ", foo.url())));
 });
@@ -1465,7 +1463,7 @@ test!(switch_deps_does_not_update_transitive {
 
             [dependencies.transitive]
             git = '{}'
-        "#, transitive.url()).as_slice())
+        "#, transitive.url()))
         .file("src/lib.rs", "")
     }).unwrap();
     let dep2 = git_repo("dep2", |project| {
@@ -1477,7 +1475,7 @@ test!(switch_deps_does_not_update_transitive {
 
             [dependencies.transitive]
             git = '{}'
-        "#, transitive.url()).as_slice())
+        "#, transitive.url()))
         .file("src/lib.rs", "")
     }).unwrap();
 
@@ -1489,13 +1487,13 @@ test!(switch_deps_does_not_update_transitive {
             authors = []
             [dependencies.dep]
             git = '{}'
-        "#, dep1.url()).as_slice())
+        "#, dep1.url()))
         .file("src/main.rs", "fn main() {}");
 
     p.build();
     assert_that(p.cargo("build"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 Updating git repository `{}`
 Updating git repository `{}`
 {compiling} transitive [..]
@@ -1516,7 +1514,7 @@ Updating git repository `{}`
 
     assert_that(p.cargo("build"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 Updating git repository `{}`
 {compiling} dep [..]
 {compiling} project [..]
@@ -1552,7 +1550,7 @@ test!(update_one_source_updates_all_packages_in_that_git_source {
             authors = []
             [dependencies.dep]
             git = '{}'
-        "#, dep.url()).as_slice())
+        "#, dep.url()))
         .file("src/main.rs", "fn main() {}");
 
     p.build();
@@ -1574,7 +1572,7 @@ test!(update_one_source_updates_all_packages_in_that_git_source {
     let mut lockfile = String::new();
     File::open(&p.root().join("Cargo.lock")).unwrap()
          .read_to_string(&mut lockfile).unwrap();
-    assert!(!lockfile.contains(rev1.to_string().as_slice()),
+    assert!(!lockfile.contains(&rev1.to_string()),
             "{} in {}", rev1, lockfile);
 });
 
@@ -1615,18 +1613,18 @@ test!(switch_sources {
             authors = []
             [dependencies.a]
             git = '{}'
-        "#, a1.url()).as_slice())
+        "#, a1.url()))
         .file("b/src/lib.rs", "fn main() {}");
 
     p.build();
     assert_that(p.cargo("build"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {updating} git repository `file://[..]a1`
 {compiling} a v0.5.0 ([..]a1#[..]
 {compiling} b v0.5.0 ([..])
 {compiling} project v0.5.0 ([..])
-", updating = UPDATING, compiling = COMPILING).as_slice()));
+", updating = UPDATING, compiling = COMPILING)));
 
     File::create(&p.root().join("b/Cargo.toml")).unwrap().write_all(format!(r#"
         [project]
@@ -1639,12 +1637,12 @@ test!(switch_sources {
 
     assert_that(p.cargo("build"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {updating} git repository `file://[..]a2`
 {compiling} a v0.5.1 ([..]a2#[..]
 {compiling} b v0.5.0 ([..])
 {compiling} project v0.5.0 ([..])
-", updating = UPDATING, compiling = COMPILING).as_slice()));
+", updating = UPDATING, compiling = COMPILING)));
 });
 
 test!(dont_require_submodules_are_checked_out {
index d4e19c306639e4841b8fd89e14ed7beee4a3a477..024699e53886375a417bd37209332013636341e3 100644 (file)
@@ -31,7 +31,7 @@ test!(cargo_compile_with_nested_deps_shorthand {
             name = "foo"
         "#)
         .file("src/foo.rs",
-              main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
+              &main_file(r#""{}", bar::gimme()"#, &["bar"]))
         .file("bar/Cargo.toml", r#"
             [project]
 
@@ -74,7 +74,7 @@ test!(cargo_compile_with_nested_deps_shorthand {
 
     assert_that(p.cargo_process("build"),
         execs().with_status(0)
-               .with_stdout(format!("{} baz v0.5.0 ({})\n\
+               .with_stdout(&format!("{} baz v0.5.0 ({})\n\
                                      {} bar v0.5.0 ({})\n\
                                      {} foo v0.5.0 ({})\n",
                                     COMPILING, p.url(),
@@ -92,13 +92,13 @@ test!(cargo_compile_with_nested_deps_shorthand {
     println!("building baz");
     assert_that(p.cargo("build").arg("-p").arg("baz"),
                 execs().with_status(0)
-                       .with_stdout(format!("{} baz v0.5.0 ({})\n",
+                       .with_stdout(&format!("{} baz v0.5.0 ({})\n",
                                             COMPILING, p.url())));
     println!("building foo");
     assert_that(p.cargo("build")
                  .arg("-p").arg("foo"),
                 execs().with_status(0)
-                       .with_stdout(format!("{} bar v0.5.0 ({})\n\
+                       .with_stdout(&format!("{} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
                                             COMPILING, p.url(),
                                             COMPILING, p.url())));
@@ -122,7 +122,7 @@ test!(cargo_compile_with_root_dev_deps {
             name = "foo"
         "#)
         .file("src/main.rs",
-              main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice());
+              &main_file(r#""{}", bar::gimme()"#, &["bar"]));
     let p2 = project("bar")
         .file("Cargo.toml", r#"
             [package]
@@ -160,7 +160,7 @@ test!(cargo_compile_with_root_dev_deps_with_testing {
             name = "foo"
         "#)
         .file("src/main.rs",
-              main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice());
+              &main_file(r#""{}", bar::gimme()"#, &["bar"]));
     let p2 = project("bar")
         .file("Cargo.toml", r#"
             [package]
@@ -177,7 +177,7 @@ test!(cargo_compile_with_root_dev_deps_with_testing {
 
     p2.build();
     assert_that(p.cargo_process("test"),
-        execs().with_stdout(format!("\
+        execs().with_stdout(&format!("\
 {compiling} [..] v0.5.0 ({url})
 {compiling} [..] v0.5.0 ({url})
 {running} target[..]foo-[..]
@@ -208,7 +208,7 @@ test!(cargo_compile_with_transitive_dev_deps {
             name = "foo"
         "#)
         .file("src/foo.rs",
-              main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
+              &main_file(r#""{}", bar::gimme()"#, &["bar"]))
         .file("bar/Cargo.toml", r#"
             [project]
 
@@ -231,7 +231,7 @@ test!(cargo_compile_with_transitive_dev_deps {
         "#);
 
     assert_that(p.cargo_process("build"),
-        execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
+        execs().with_stdout(&format!("{} bar v0.5.0 ({})\n\
                                      {} foo v0.5.0 ({})\n",
                                     COMPILING, p.url(),
                                     COMPILING, p.url())));
@@ -273,7 +273,7 @@ test!(no_rebuild_dependency {
         "#);
     // First time around we should compile both foo and bar
     assert_that(p.cargo_process("build"),
-                execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
+                execs().with_stdout(&format!("{} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
                                             COMPILING, p.url(),
                                             COMPILING, p.url())));
@@ -284,7 +284,7 @@ test!(no_rebuild_dependency {
 
     p.build(); // rebuild the files (rewriting them in the process)
     assert_that(p.cargo("build"),
-                execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
+                execs().with_stdout(&format!("{} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
                                             COMPILING, p.url(),
                                             COMPILING, p.url())));
@@ -339,7 +339,7 @@ test!(deep_dependencies_trigger_rebuild {
             pub fn baz() {}
         "#);
     assert_that(p.cargo_process("build"),
-                execs().with_stdout(format!("{} baz v0.5.0 ({})\n\
+                execs().with_stdout(&format!("{} baz v0.5.0 ({})\n\
                                              {} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
                                             COMPILING, p.url(),
@@ -357,7 +357,7 @@ test!(deep_dependencies_trigger_rebuild {
         pub fn baz() { println!("hello!"); }
     "#).unwrap();
     assert_that(p.cargo("build"),
-                execs().with_stdout(format!("{} baz v0.5.0 ({})\n\
+                execs().with_stdout(&format!("{} baz v0.5.0 ({})\n\
                                              {} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
                                             COMPILING, p.url(),
@@ -371,7 +371,7 @@ test!(deep_dependencies_trigger_rebuild {
         pub fn bar() { println!("hello!"); baz::baz(); }
     "#).unwrap();
     assert_that(p.cargo("build"),
-                execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
+                execs().with_stdout(&format!("{} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
                                             COMPILING, p.url(),
                                             COMPILING, p.url())));
@@ -428,7 +428,7 @@ test!(no_rebuild_two_deps {
             pub fn baz() {}
         "#);
     assert_that(p.cargo_process("build"),
-                execs().with_stdout(format!("{} baz v0.5.0 ({})\n\
+                execs().with_stdout(&format!("{} baz v0.5.0 ({})\n\
                                              {} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
                                             COMPILING, p.url(),
@@ -459,7 +459,7 @@ test!(nested_deps_recompile {
             name = "foo"
         "#)
         .file("src/foo.rs",
-              main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
+              &main_file(r#""{}", bar::gimme()"#, &["bar"]))
         .file("src/bar/Cargo.toml", r#"
             [project]
 
@@ -475,7 +475,7 @@ test!(nested_deps_recompile {
     let bar = p.url();
 
     assert_that(p.cargo_process("build"),
-                execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
+                execs().with_stdout(&format!("{} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
                                             COMPILING, bar,
                                             COMPILING, p.url())));
@@ -487,7 +487,7 @@ test!(nested_deps_recompile {
 
     // This shouldn't recompile `bar`
     assert_that(p.cargo("build"),
-                execs().with_stdout(format!("{} foo v0.5.0 ({})\n",
+                execs().with_stdout(&format!("{} foo v0.5.0 ({})\n",
                                             COMPILING, p.url())));
 });
 
@@ -649,7 +649,7 @@ test!(path_dep_build_cmd {
             name = "foo"
         "#)
         .file("src/foo.rs",
-              main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
+              &main_file(r#""{}", bar::gimme()"#, &["bar"]))
         .file("bar/Cargo.toml", r#"
             [project]
 
@@ -676,7 +676,7 @@ test!(path_dep_build_cmd {
     p.root().join("bar").move_into_the_past().unwrap();
 
     assert_that(p.cargo("build"),
-        execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
+        execs().with_stdout(&format!("{} bar v0.5.0 ({})\n\
                                      {} foo v0.5.0 ({})\n",
                                     COMPILING, p.url(),
                                     COMPILING, p.url())));
@@ -693,7 +693,7 @@ test!(path_dep_build_cmd {
     }
 
     assert_that(p.cargo("build"),
-        execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
+        execs().with_stdout(&format!("{} bar v0.5.0 ({})\n\
                                      {} foo v0.5.0 ({})\n",
                                     COMPILING, p.url(),
                                     COMPILING, p.url())));
@@ -733,12 +733,12 @@ test!(dev_deps_no_rebuild_lib {
     assert_that(p.cargo("build")
                  .env("FOO", "bar"),
                 execs().with_status(0)
-                       .with_stdout(format!("{} foo v0.5.0 ({})\n",
+                       .with_stdout(&format!("{} foo v0.5.0 ({})\n",
                                             COMPILING, p.url())));
 
     assert_that(p.cargo("test"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {} [..] v0.5.0 ({})
 {} [..] v0.5.0 ({})
 Running target[..]foo-[..]
index 4280bd593c5163ffe955c9cfd7704689a1643d0e..938487a5a03859b8a064c2f84aca4bca2f53d66c 100644 (file)
@@ -138,18 +138,18 @@ test!(plugin_with_dynamic_native_dependency {
             plugin = true
         "#)
         .file("bar/build.rs", r#"
-            use std::old_io::fs;
-            use std::old_path::{Path, GenericPath};
-            use std::os;
+            #![feature(convert)]
+            use std::path::PathBuf;
+            use std::env;
 
             fn main() {
-                let src = Path::new(os::getenv("SRC").unwrap());
-                println!("cargo:rustc-flags=-L {}", src.dir_path().display());
+                let src = PathBuf::from(env::var("SRC").unwrap());
+                println!("cargo:rustc-flags=-L {}", src.parent().unwrap()
+                                                       .display());
             }
         "#)
         .file("bar/src/lib.rs", &format!(r#"
-            #![feature(plugin_registrar)]
-
+            #![feature(plugin_registrar, rustc_private)]
             extern crate rustc;
 
             use rustc::plugin::Registry;
index 81a4e81ed02cb6be7500ad03ffb7c5ee80d04295..a650ec1b165e11941c1a72b606de239c35daabf6 100644 (file)
@@ -12,7 +12,7 @@ fn setup() {
 fn disabled() -> bool {
     // First, disable if ./configure requested so
     match env::var("CFG_DISABLE_CROSS_TESTS") {
-        Ok(ref s) if s.as_slice() == "1" => return true,
+        Ok(ref s) if *s == "1" => return true,
         _ => {}
     }
 
@@ -41,11 +41,11 @@ test!(simple_cross {
             authors = []
             build = "build.rs"
         "#)
-        .file("build.rs", format!(r#"
+        .file("build.rs", &format!(r#"
             fn main() {{
-                assert_eq!(std::env::var("TARGET").unwrap().as_slice(), "{}");
+                assert_eq!(std::env::var("TARGET").unwrap(), "{}");
             }}
-        "#, alternate()).as_slice())
+        "#, alternate()))
         .file("src/main.rs", r#"
             use std::env;
             fn main() {
@@ -263,12 +263,12 @@ test!(linker_and_ar {
 
     let target = alternate();
     let p = project("foo")
-        .file(".cargo/config", format!(r#"
+        .file(".cargo/config", &format!(r#"
             [target.{}]
             ar = "my-ar-tool"
             linker = "my-linker-tool"
-        "#, target).as_slice())
-        .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
+        "#, target))
+        .file("Cargo.toml", &basic_bin_manifest("foo"))
         .file("src/foo.rs", r#"
             use std::env;
             fn main() {
@@ -279,7 +279,7 @@ test!(linker_and_ar {
     assert_that(p.cargo_process("build").arg("--target").arg(target)
                                               .arg("-v"),
                 execs().with_status(101)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.5.0 ({url})
 {running} `rustc src/foo.rs --crate-name foo --crate-type bin -g \
     --out-dir {dir}[..]target[..]{target}[..]debug \
@@ -294,7 +294,7 @@ test!(linker_and_ar {
                             dir = p.root().display(),
                             url = p.url(),
                             target = target,
-                            ).as_slice()));
+                            )));
 });
 
 test!(plugin_with_extra_dylib_dep {
@@ -393,7 +393,7 @@ test!(cross_tests {
     let target = alternate();
     assert_that(p.cargo_process("test").arg("--target").arg(target),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.0 ({foo})
 {running} target[..]{triple}[..]bar-[..]
 
@@ -453,36 +453,38 @@ test!(cross_with_a_build_script {
             authors = []
             build = 'build.rs'
         "#)
-        .file("build.rs", format!(r#"
+        .file("build.rs", &format!(r#"
+            #![feature(convert)]
             use std::env;
-            use std::old_path::{{Path, GenericPath}};
+            use std::path::PathBuf;
             fn main() {{
-                assert_eq!(env::var("TARGET").unwrap().as_slice(), "{0}");
-                let mut path = Path::new(env::var("OUT_DIR").unwrap());
-                assert_eq!(path.filename().unwrap(), b"out");
+                assert_eq!(env::var("TARGET").unwrap(), "{0}");
+                let mut path = PathBuf::from(env::var_os("OUT_DIR").unwrap());
+                assert_eq!(path.file_name().unwrap().to_str().unwrap(), "out");
                 path.pop();
-                assert!(path.filename().unwrap().starts_with(b"foo-"));
+                assert!(path.file_name().unwrap().to_str().unwrap()
+                            .starts_with("foo-"));
                 path.pop();
-                assert_eq!(path.filename().unwrap(), b"build");
+                assert_eq!(path.file_name().unwrap().to_str().unwrap(), "build");
                 path.pop();
-                assert_eq!(path.filename().unwrap(), b"debug");
+                assert_eq!(path.file_name().unwrap().to_str().unwrap(), "debug");
                 path.pop();
-                assert_eq!(path.filename().unwrap(), b"{0}");
+                assert_eq!(path.file_name().unwrap().to_str().unwrap(), "{0}");
                 path.pop();
-                assert_eq!(path.filename().unwrap(), b"target");
+                assert_eq!(path.file_name().unwrap().to_str().unwrap(), "target");
             }}
-        "#, target).as_slice())
+        "#, target))
         .file("src/main.rs", "fn main() {}");
 
     assert_that(p.cargo_process("build").arg("--target").arg(&target).arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.0 (file://[..])
 {running} `rustc build.rs [..] --out-dir {dir}[..]target[..]build[..]foo-[..]`
 {running} `{dir}[..]target[..]build[..]foo-[..]build-script-build`
 {running} `rustc src[..]main.rs [..] --target {target} [..]`
 ", compiling = COMPILING, running = RUNNING, target = target,
-   dir = p.root().display()).as_slice()));
+   dir = p.root().display())));
 });
 
 test!(build_script_needed_for_host_and_target {
@@ -545,7 +547,7 @@ test!(build_script_needed_for_host_and_target {
 
     assert_that(p.cargo_process("build").arg("--target").arg(&target).arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} d1 v0.0.0 (file://{dir})
 {running} `rustc d1[..]build.rs [..] --out-dir {dir}[..]target[..]build[..]d1-[..]`
 {running} `{dir}[..]target[..]build[..]d1-[..]build-script-build`
@@ -564,7 +566,7 @@ test!(build_script_needed_for_host_and_target {
 {running} `rustc src[..]main.rs [..] --target {target} [..] \
            -L /path/to/{target}`
 ", compiling = COMPILING, running = RUNNING, target = target, host = host,
-   dir = p.root().display()).as_slice()));
+   dir = p.root().display())));
 });
 
 test!(build_deps_for_the_right_arch {
@@ -668,7 +670,7 @@ test!(plugin_build_script_right_arch {
 
     assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(alternate()),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.1 ([..])
 {running} `rustc build.rs [..]`
 {running} `[..]build-script-build[..]`
index 8f0c23ce66abf859f1d03b9664b01bad8fa48f63..3c90b2513c2f1740e58e6aa9b7253ea5c9a43364 100644 (file)
@@ -20,11 +20,11 @@ test!(simple {
         "#);
 
     assert_that(p.cargo_process("doc"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 ",
         compiling = COMPILING,
-        dir = path2url(p.root())).as_slice()));
+        dir = path2url(p.root()))));
     assert_that(&p.root().join("target/doc"), existing_dir());
     assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
 });
@@ -62,11 +62,11 @@ test!(doc_twice {
         "#);
 
     assert_that(p.cargo_process("doc"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 ",
         compiling = COMPILING,
-        dir = path2url(p.root())).as_slice()));
+        dir = path2url(p.root()))));
 
     assert_that(p.cargo("doc"),
                 execs().with_status(0).with_stdout(""))
@@ -98,12 +98,12 @@ test!(doc_deps {
         "#);
 
     assert_that(p.cargo_process("doc"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} bar v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir})
 ",
         compiling = COMPILING,
-        dir = path2url(p.root())).as_slice()));
+        dir = path2url(p.root()))));
 
     assert_that(&p.root().join("target/doc"), existing_dir());
     assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
@@ -144,12 +144,12 @@ test!(doc_no_deps {
         "#);
 
     assert_that(p.cargo_process("doc").arg("--no-deps"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} bar v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir})
 ",
         compiling = COMPILING,
-        dir = path2url(p.root())).as_slice()));
+        dir = path2url(p.root()))));
 
     assert_that(&p.root().join("target/doc"), existing_dir());
     assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
@@ -240,10 +240,10 @@ test!(doc_dash_p {
 
     assert_that(p.cargo_process("doc").arg("-p").arg("a"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} b v0.0.1 (file://[..])
 {compiling} a v0.0.1 (file://[..])
-", compiling = COMPILING).as_slice()));
+", compiling = COMPILING)));
 });
 
 test!(doc_same_name {
index 05069a31ec531c6ff8349a6553ac43b872d05075..10bb898e20cb229321d3a74997d15e2988afa5b6 100644 (file)
@@ -23,12 +23,12 @@ test!(invalid1 {
         .file("src/main.rs", "");
 
     assert_that(p.cargo_process("build"),
-                execs().with_status(101).with_stderr(format!("\
+                execs().with_status(101).with_stderr(&format!("\
 failed to parse manifest at `[..]`
 
 Caused by:
   Feature `bar` includes `baz` which is neither a dependency nor another feature
-").as_slice()));
+")));
 });
 
 test!(invalid2 {
@@ -48,12 +48,12 @@ test!(invalid2 {
         .file("src/main.rs", "");
 
     assert_that(p.cargo_process("build"),
-                execs().with_status(101).with_stderr(format!("\
+                execs().with_status(101).with_stderr(&format!("\
 failed to parse manifest at `[..]`
 
 Caused by:
   Features and dependencies cannot have the same name: `bar`
-").as_slice()));
+")));
 });
 
 test!(invalid3 {
@@ -73,13 +73,13 @@ test!(invalid3 {
         .file("src/main.rs", "");
 
     assert_that(p.cargo_process("build"),
-                execs().with_status(101).with_stderr(format!("\
+                execs().with_status(101).with_stderr(&format!("\
 failed to parse manifest at `[..]`
 
 Caused by:
   Feature `bar` depends on `baz` which is not an optional dependency.
 Consider adding `optional = true` to the dependency
-").as_slice()));
+")));
 });
 
 test!(invalid4 {
@@ -104,9 +104,9 @@ test!(invalid4 {
         .file("bar/src/lib.rs", "");
 
     assert_that(p.cargo_process("build"),
-                execs().with_status(101).with_stderr(format!("\
+                execs().with_status(101).with_stderr(&format!("\
 Package `bar v0.0.1 ([..])` does not have these features: `bar`
-").as_slice()));
+")));
 
     let p = p.file("Cargo.toml", r#"
             [project]
@@ -116,9 +116,9 @@ Package `bar v0.0.1 ([..])` does not have these features: `bar`
         "#);
 
     assert_that(p.cargo_process("build").arg("--features").arg("test"),
-                execs().with_status(101).with_stderr(format!("\
+                execs().with_status(101).with_stderr(&format!("\
 Package `foo v0.0.1 ([..])` does not have these features: `test`
-").as_slice()));
+")));
 });
 
 test!(invalid5 {
@@ -136,12 +136,12 @@ test!(invalid5 {
         .file("src/main.rs", "");
 
     assert_that(p.cargo_process("build"),
-                execs().with_status(101).with_stderr(format!("\
+                execs().with_status(101).with_stderr(&format!("\
 failed to parse manifest at `[..]`
 
 Caused by:
   Dev-dependencies are not allowed to be optional: `bar`
-").as_slice()));
+")));
 });
 
 test!(invalid6 {
@@ -158,12 +158,12 @@ test!(invalid6 {
         .file("src/main.rs", "");
 
     assert_that(p.cargo_process("build").arg("--features").arg("foo"),
-                execs().with_status(101).with_stderr(format!("\
+                execs().with_status(101).with_stderr(&format!("\
 failed to parse manifest at `[..]`
 
 Caused by:
   Feature `foo` requires `bar` which is not an optional dependency
-").as_slice()));
+")));
 });
 
 test!(invalid7 {
@@ -181,12 +181,12 @@ test!(invalid7 {
         .file("src/main.rs", "");
 
     assert_that(p.cargo_process("build").arg("--features").arg("foo"),
-                execs().with_status(101).with_stderr(format!("\
+                execs().with_status(101).with_stderr(&format!("\
 failed to parse manifest at `[..]`
 
 Caused by:
   Feature `foo` requires `bar` which is not an optional dependency
-").as_slice()));
+")));
 });
 
 test!(invalid8 {
@@ -211,9 +211,9 @@ test!(invalid8 {
         .file("bar/src/lib.rs", "");
 
     assert_that(p.cargo_process("build").arg("--features").arg("foo"),
-                execs().with_status(101).with_stderr(format!("\
+                execs().with_status(101).with_stderr(&format!("\
 features in dependencies cannot enable features in other dependencies: `foo/bar`
-").as_slice()));
+")));
 });
 
 test!(no_feature_doesnt_build {
@@ -247,7 +247,7 @@ test!(no_feature_doesnt_build {
     assert_that(p.cargo_process("build"),
                 execs().with_status(0).with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = p.url()).as_slice()));
+", compiling = COMPILING, dir = p.url())));
     assert_that(p.process(&p.bin("foo")),
                 execs().with_status(0).with_stdout(""));
 
@@ -255,7 +255,7 @@ test!(no_feature_doesnt_build {
                 execs().with_status(0).with_stdout(format!("\
 {compiling} bar v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = p.url()).as_slice()));
+", compiling = COMPILING, dir = p.url())));
     assert_that(p.process(&p.bin("foo")),
                 execs().with_status(0).with_stdout("bar\n"));
 });
@@ -295,14 +295,14 @@ test!(default_feature_pulled_in {
                 execs().with_status(0).with_stdout(format!("\
 {compiling} bar v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = p.url()).as_slice()));
+", compiling = COMPILING, dir = p.url())));
     assert_that(p.process(&p.bin("foo")),
                 execs().with_status(0).with_stdout("bar\n"));
 
     assert_that(p.cargo("build").arg("--no-default-features"),
                 execs().with_status(0).with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = p.url()).as_slice()));
+", compiling = COMPILING, dir = p.url())));
     assert_that(p.process(&p.bin("foo")),
                 execs().with_status(0).with_stdout(""));
 });
@@ -397,7 +397,7 @@ test!(groups_on_groups_on_groups {
 {compiling} ba[..] v0.0.1 ({dir})
 {compiling} ba[..] v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = p.url()).as_slice()));
+", compiling = COMPILING, dir = p.url())));
 });
 
 test!(many_cli_features {
@@ -441,7 +441,7 @@ test!(many_cli_features {
 {compiling} ba[..] v0.0.1 ({dir})
 {compiling} ba[..] v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = p.url()).as_slice()));
+", compiling = COMPILING, dir = p.url())));
 });
 
 test!(union_features {
@@ -502,7 +502,7 @@ test!(union_features {
 {compiling} d2 v0.0.1 ({dir})
 {compiling} d1 v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir})
-", compiling = COMPILING, dir = p.url()).as_slice()));
+", compiling = COMPILING, dir = p.url())));
 });
 
 test!(many_features_no_rebuilds {
@@ -535,14 +535,14 @@ test!(many_features_no_rebuilds {
                 execs().with_status(0).with_stdout(format!("\
 {compiling} a v0.1.0 ({dir})
 {compiling} b v0.1.0 ({dir})
-", compiling = COMPILING, dir = p.url()).as_slice()));
+", compiling = COMPILING, dir = p.url())));
     p.root().move_into_the_past().unwrap();
 
     assert_that(p.cargo("build").arg("-v"),
                 execs().with_status(0).with_stdout(format!("\
 {fresh} a v0.1.0 ([..])
 {fresh} b v0.1.0 ([..])
-", fresh = FRESH).as_slice()));
+", fresh = FRESH)));
 });
 
 // Tests that all cmd lines work with `--features ""`
index a3fcbbcb07b3c2a331d8fc658bacf54c05d25513..84445495957bc5d13f1ee8c1742796441aca89fe 100644 (file)
@@ -30,7 +30,7 @@ test!(simple {
         .file("src/bar.txt", ""); // should be ignored when packaging
 
     assert_that(p.cargo_process("package"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {packaging} foo v0.0.1 ({dir})
 {verifying} foo v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir}[..])
@@ -38,7 +38,7 @@ test!(simple {
         packaging = PACKAGING,
         verifying = VERIFYING,
         compiling = COMPILING,
-        dir = p.url()).as_slice()));
+        dir = p.url())));
     assert_that(&p.root().join("target/package/foo-0.0.1.crate"), existing_file());
     assert_that(p.cargo("package").arg("-l"),
                 execs().with_status(0).with_stdout("\
@@ -74,7 +74,7 @@ test!(metadata_warning {
             fn main() {}
         "#);
     assert_that(p.cargo_process("package"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {packaging} foo v0.0.1 ({dir})
 {verifying} foo v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir}[..])
@@ -82,7 +82,7 @@ test!(metadata_warning {
         packaging = PACKAGING,
         verifying = VERIFYING,
         compiling = COMPILING,
-        dir = p.url()).as_slice())
+        dir = p.url()))
                 .with_stderr("\
 warning: manifest has no description, license, license-file, documentation, \
 homepage or repository. See \
@@ -100,7 +100,7 @@ http://doc.crates.io/manifest.html#package-metadata for more info."));
             fn main() {}
         "#);
     assert_that(p.cargo_process("package"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {packaging} foo v0.0.1 ({dir})
 {verifying} foo v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir}[..])
@@ -108,7 +108,7 @@ http://doc.crates.io/manifest.html#package-metadata for more info."));
         packaging = PACKAGING,
         verifying = VERIFYING,
         compiling = COMPILING,
-        dir = p.url()).as_slice())
+        dir = p.url()))
                 .with_stderr("\
 warning: manifest has no description, documentation, homepage or repository. See \
 http://doc.crates.io/manifest.html#package-metadata for more info."));
@@ -127,7 +127,7 @@ http://doc.crates.io/manifest.html#package-metadata for more info."));
             fn main() {}
         "#);
     assert_that(p.cargo_process("package"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {packaging} foo v0.0.1 ({dir})
 {verifying} foo v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir}[..])
@@ -135,7 +135,7 @@ http://doc.crates.io/manifest.html#package-metadata for more info."));
         packaging = PACKAGING,
         verifying = VERIFYING,
         compiling = COMPILING,
-        dir = p.url()).as_slice()));
+        dir = p.url())));
 });
 
 test!(package_verbose {
@@ -161,15 +161,14 @@ test!(package_verbose {
     let mut cargo = process(&cargo_dir().join("cargo")).unwrap();
     cargo.cwd(&root).env("HOME", &paths::home());
     assert_that(cargo.clone().arg("build"), execs().with_status(0));
-    assert_that(cargo.arg("package").arg("-v")
-                                                    .arg("--no-verify"),
-                execs().with_status(0).with_stdout(format!("\
+    assert_that(cargo.arg("package").arg("-v").arg("--no-verify"),
+                execs().with_status(0).with_stdout(&format!("\
 {packaging} foo v0.0.1 ([..])
 {archiving} [..]
 {archiving} [..]
 ",
         packaging = PACKAGING,
-        archiving = ARCHIVING).as_slice()));
+        archiving = ARCHIVING)));
 });
 
 test!(package_verification {
@@ -186,7 +185,7 @@ test!(package_verification {
     assert_that(p.cargo_process("build"),
                 execs().with_status(0));
     assert_that(p.cargo("package"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {packaging} foo v0.0.1 ({dir})
 {verifying} foo v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir}[..])
@@ -194,7 +193,7 @@ test!(package_verification {
         packaging = PACKAGING,
         verifying = VERIFYING,
         compiling = COMPILING,
-        dir = p.url()).as_slice()));
+        dir = p.url())));
 });
 
 test!(exclude {
@@ -213,11 +212,11 @@ test!(exclude {
         .file("src/bar.txt", "");
 
     assert_that(p.cargo_process("package").arg("--no-verify").arg("-v"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {packaging} foo v0.0.1 ([..])
 {archiving} [..]
 {archiving} [..]
-", packaging = PACKAGING, archiving = ARCHIVING).as_slice()));
+", packaging = PACKAGING, archiving = ARCHIVING)));
 });
 
 test!(include {
@@ -237,12 +236,12 @@ test!(include {
         .file("src/bar.txt", ""); // should be ignored when packaging
 
     assert_that(p.cargo_process("package").arg("--no-verify").arg("-v"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {packaging} foo v0.0.1 ([..])
 {archiving} [..]
 {archiving} [..]
 {archiving} [..]
-", packaging = PACKAGING, archiving = ARCHIVING).as_slice()));
+", packaging = PACKAGING, archiving = ARCHIVING)));
 });
 
 test!(package_lib_with_bin {
index 4e01484059d0350d946ee82f8cd1e1c325fe07ee..c6760ae2dc3a71bf54523ecd534171f0cbcc7da7 100644 (file)
@@ -25,7 +25,7 @@ test!(profile_overrides {
         "#)
         .file("src/lib.rs", "");
     assert_that(p.cargo_process("build").arg("-v"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} test v0.0.0 ({url})
 {running} `rustc src{sep}lib.rs --crate-name test --crate-type lib \
         -C opt-level=1 \
@@ -79,7 +79,7 @@ test!(top_level_overrides_deps {
         "#)
         .file("foo/src/lib.rs", "");
     assert_that(p.cargo_process("build").arg("-v").arg("--release"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} foo v0.0.0 ({url})
 {running} `rustc foo{sep}src{sep}lib.rs --crate-name foo \
         --crate-type dylib --crate-type rlib -C prefer-dynamic \
@@ -111,5 +111,5 @@ test!(top_level_overrides_deps {
                     url = p.url(),
                     sep = SEP,
                     prefix = env::consts::DLL_PREFIX,
-                    suffix = env::consts::DLL_SUFFIX).as_slice()));
+                    suffix = env::consts::DLL_SUFFIX)));
 });
index 55eef734d9902e6e87fc0477644933273b92f041..c83b1406676caf63bb0d956dabbed96ce672587a 100644 (file)
@@ -50,7 +50,7 @@ test!(simple {
         .file("src/main.rs", "fn main() {}");
 
     assert_that(p.cargo_process("publish").arg("--no-verify"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} registry `{reg}`
 {packaging} foo v0.0.1 ({dir})
 {uploading} foo v0.0.1 ({dir})
@@ -59,7 +59,7 @@ test!(simple {
         uploading = UPLOADING,
         packaging = PACKAGING,
         dir = p.url(),
-        reg = registry()).as_slice()));
+        reg = registry())));
 
     let mut f = File::open(&upload_path().join("api/v1/crates/new")).unwrap();
     // Skip the metadata payload and the size of the tarball
index 47ae6bd256322db9976624059f5cedd2503590b4..3f7a70ebfb521c3a4ee56648ec531ac2cc7ba630 100644 (file)
@@ -30,7 +30,7 @@ test!(simple {
     r::mock_pkg("bar", "0.0.1", &[]);
 
     assert_that(p.cargo_process("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} registry `{reg}`
 {downloading} bar v0.0.1 (registry file://[..])
 {compiling} bar v0.0.1 (registry file://[..])
@@ -40,18 +40,18 @@ test!(simple {
         downloading = DOWNLOADING,
         compiling = COMPILING,
         dir = p.url(),
-        reg = r::registry()).as_slice()));
+        reg = r::registry())));
 
     // Don't download a second time
     assert_that(p.cargo_process("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} registry `{reg}`
 [..] bar v0.0.1 (registry file://[..])
 [..] foo v0.0.1 ({dir})
 ",
         updating = UPDATING,
         dir = p.url(),
-        reg = r::registry()).as_slice()));
+        reg = r::registry())));
 });
 
 test!(deps {
@@ -71,7 +71,7 @@ test!(deps {
     r::mock_pkg("bar", "0.0.1", &[("baz", "*", "normal")]);
 
     assert_that(p.cargo_process("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} registry `{reg}`
 {downloading} [..] v0.0.1 (registry file://[..])
 {downloading} [..] v0.0.1 (registry file://[..])
@@ -83,7 +83,7 @@ test!(deps {
         downloading = DOWNLOADING,
         compiling = COMPILING,
         dir = p.url(),
-        reg = r::registry()).as_slice()));
+        reg = r::registry())));
 });
 
 test!(nonexistent {
@@ -194,7 +194,7 @@ version required: >= 0.0.0
     r::mock_pkg("notyet", "0.0.1", &[]);
 
     assert_that(p.cargo("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} registry `{reg}`
 {downloading} notyet v0.0.1 (registry file://[..])
 {compiling} notyet v0.0.1 (registry file://[..])
@@ -204,7 +204,7 @@ version required: >= 0.0.0
         downloading = DOWNLOADING,
         compiling = COMPILING,
         dir = p.url(),
-        reg = r::registry()).as_slice()));
+        reg = r::registry())));
 });
 
 test!(package_with_path_deps {
@@ -279,13 +279,13 @@ test!(lockfile_locks {
     r::mock_pkg("bar", "0.0.1", &[]);
 
     assert_that(p.cargo("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} registry `[..]`
 {downloading} bar v0.0.1 (registry file://[..])
 {compiling} bar v0.0.1 (registry file://[..])
 {compiling} foo v0.0.1 ({dir})
 ", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
-   dir = p.url()).as_slice()));
+   dir = p.url())));
 
     p.root().move_into_the_past().unwrap();
     r::mock_pkg("bar", "0.0.2", &[]);
@@ -312,7 +312,7 @@ test!(lockfile_locks_transitively {
     r::mock_pkg("bar", "0.0.1", &[("baz", "*", "normal")]);
 
     assert_that(p.cargo("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} registry `[..]`
 {downloading} [..] v0.0.1 (registry file://[..])
 {downloading} [..] v0.0.1 (registry file://[..])
@@ -320,7 +320,7 @@ test!(lockfile_locks_transitively {
 {compiling} bar v0.0.1 (registry file://[..])
 {compiling} foo v0.0.1 ({dir})
 ", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
-   dir = p.url()).as_slice()));
+   dir = p.url())));
 
     p.root().move_into_the_past().unwrap();
     r::mock_pkg("baz", "0.0.2", &[]);
@@ -350,7 +350,7 @@ test!(yanks_are_not_used {
     r::mock_pkg_yank("bar", "0.0.2", &[("baz", "*", "normal")], true);
 
     assert_that(p.cargo("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} registry `[..]`
 {downloading} [..] v0.0.1 (registry file://[..])
 {downloading} [..] v0.0.1 (registry file://[..])
@@ -358,7 +358,7 @@ test!(yanks_are_not_used {
 {compiling} bar v0.0.1 (registry file://[..])
 {compiling} foo v0.0.1 ({dir})
 ", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
-   dir = p.url()).as_slice()));
+   dir = p.url())));
 });
 
 test!(relying_on_a_yank_is_bad {
@@ -443,10 +443,10 @@ test!(update_with_lockfile_if_packages_missing {
 
     paths::home().join(".cargo/registry").rm_rf().unwrap();
     assert_that(p.cargo("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} registry `[..]`
 {downloading} bar v0.0.1 (registry file://[..])
-", updating = UPDATING, downloading = DOWNLOADING).as_slice()));
+", updating = UPDATING, downloading = DOWNLOADING)));
 });
 
 test!(update_lockfile {
@@ -474,34 +474,34 @@ test!(update_lockfile {
     println!("0.0.2 update");
     assert_that(p.cargo("update")
                  .arg("-p").arg("bar").arg("--precise").arg("0.0.2"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} registry `[..]`
-", updating = UPDATING).as_slice()));
+", updating = UPDATING)));
 
     println!("0.0.2 build");
     assert_that(p.cargo("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {downloading} [..] v0.0.2 (registry file://[..])
 {compiling} bar v0.0.2 (registry file://[..])
 {compiling} foo v0.0.1 ({dir})
 ", downloading = DOWNLOADING, compiling = COMPILING,
-   dir = p.url()).as_slice()));
+   dir = p.url())));
 
     println!("0.0.3 update");
     assert_that(p.cargo("update")
                  .arg("-p").arg("bar"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} registry `[..]`
-", updating = UPDATING).as_slice()));
+", updating = UPDATING)));
 
     println!("0.0.3 build");
     assert_that(p.cargo("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {downloading} [..] v0.0.3 (registry file://[..])
 {compiling} bar v0.0.3 (registry file://[..])
 {compiling} foo v0.0.1 ({dir})
 ", downloading = DOWNLOADING, compiling = COMPILING,
-   dir = p.url()).as_slice()));
+   dir = p.url())));
 });
 
 test!(dev_dependency_not_used {
@@ -522,13 +522,13 @@ test!(dev_dependency_not_used {
     r::mock_pkg("bar", "0.0.1", &[("baz", "*", "dev")]);
 
     assert_that(p.cargo("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} registry `[..]`
 {downloading} [..] v0.0.1 (registry file://[..])
 {compiling} bar v0.0.1 (registry file://[..])
 {compiling} foo v0.0.1 ({dir})
 ", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
-   dir = p.url()).as_slice()));
+   dir = p.url())));
 });
 
 test!(login_with_no_cargo_dir {
@@ -588,14 +588,14 @@ test!(updating_a_dep {
     r::mock_pkg("bar", "0.0.1", &[]);
 
     assert_that(p.cargo("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} registry `[..]`
 {downloading} bar v0.0.1 (registry file://[..])
 {compiling} bar v0.0.1 (registry file://[..])
 {compiling} a v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir})
 ", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
-   dir = p.url()).as_slice()));
+   dir = p.url())));
 
     File::create(&p.root().join("a/Cargo.toml")).unwrap().write_all(br#"
         [project]
@@ -610,14 +610,14 @@ test!(updating_a_dep {
 
     println!("second");
     assert_that(p.cargo("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} registry `[..]`
 {downloading} bar v0.1.0 (registry file://[..])
 {compiling} bar v0.1.0 (registry file://[..])
 {compiling} a v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir})
 ", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
-   dir = p.url()).as_slice()));
+   dir = p.url())));
 });
 
 test!(git_and_registry_dep {
@@ -653,7 +653,7 @@ test!(git_and_registry_dep {
 
     p.root().move_into_the_past().unwrap();
     assert_that(p.cargo("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} [..]
 {updating} [..]
 {downloading} a v0.0.1 (registry file://[..])
@@ -661,7 +661,7 @@ test!(git_and_registry_dep {
 {compiling} b v0.0.1 ([..])
 {compiling} foo v0.0.1 ({dir})
 ", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
-   dir = p.url()).as_slice()));
+   dir = p.url())));
     p.root().move_into_the_past().unwrap();
 
     println!("second");
@@ -700,13 +700,13 @@ test!(update_publish_then_update {
 
     fs::remove_dir_all(&p.root().join("target")).unwrap();
     assert_that(p.cargo("build"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {updating} [..]
 {downloading} a v0.1.1 (registry file://[..])
 {compiling} a v0.1.1 (registry [..])
 {compiling} foo v0.5.0 ({dir})
 ", updating = UPDATING, downloading = DOWNLOADING, compiling = COMPILING,
-   dir = p.url()).as_slice()));
+   dir = p.url())));
 
 });
 
index 7b92454a96d2feb7d26c0ef33feb27206f46e056..616eb3313c44d54e3334401670873ca6ee9edf6b 100644 (file)
@@ -20,7 +20,7 @@ test!(simple {
         "#);
 
     assert_that(p.cargo_process("run"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} `target{sep}debug{sep}foo[..]`
 hello
@@ -28,7 +28,7 @@ hello
         compiling = COMPILING,
         running = RUNNING,
         dir = path2url(p.root()),
-        sep = SEP).as_slice()));
+        sep = SEP)));
     assert_that(&p.bin("foo"), existing_file());
 });
 
@@ -42,8 +42,8 @@ test!(simple_with_args {
         "#)
         .file("src/main.rs", r#"
             fn main() {
-                assert_eq!(std::os::args()[1].as_slice(), "hello");
-                assert_eq!(std::os::args()[2].as_slice(), "world");
+                assert_eq!(std::env::args().nth(1).unwrap(), "hello");
+                assert_eq!(std::env::args().nth(2).unwrap(), "world");
             }
         "#);
 
@@ -60,7 +60,8 @@ test!(exit_code {
             authors = []
         "#)
         .file("src/main.rs", r#"
-            fn main() { std::os::set_exit_status(2); }
+            #![feature(exit_status)]
+            fn main() { std::env::set_exit_status(2); }
         "#);
 
     assert_that(p.cargo_process("run"),
@@ -121,7 +122,7 @@ test!(specify_name {
         "#);
 
     assert_that(p.cargo_process("run").arg("--bin").arg("a").arg("-v"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} `rustc src[..]lib.rs [..]`
 {running} `rustc src[..]a.rs [..]`
@@ -131,17 +132,17 @@ hello a.rs
         compiling = COMPILING,
         running = RUNNING,
         dir = path2url(p.root()),
-        sep = SEP).as_slice()));
+        sep = SEP)));
 
     assert_that(p.cargo("run").arg("--bin").arg("b").arg("-v"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} foo v0.0.1 ([..])
 {running} `rustc src[..]b.rs [..]`
 {running} `target{sep}debug{sep}b[..]`
 hello b.rs
 ",
         running = RUNNING, compiling = COMPILING,
-        sep = SEP).as_slice()));
+        sep = SEP)));
 });
 
 test!(run_example {
@@ -161,7 +162,7 @@ test!(run_example {
         "#);
 
     assert_that(p.cargo_process("run").arg("--example").arg("a"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} `target{sep}debug{sep}examples{sep}a[..]`
 example
@@ -169,7 +170,7 @@ example
         compiling = COMPILING,
         running = RUNNING,
         dir = path2url(p.root()),
-        sep = SEP).as_slice()));
+        sep = SEP)));
 });
 
 test!(either_name_or_example {
@@ -214,7 +215,7 @@ test!(one_bin_multiple_examples {
         "#);
 
     assert_that(p.cargo_process("run"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} `target{sep}debug{sep}main[..]`
 hello main.rs
@@ -222,7 +223,7 @@ hello main.rs
         compiling = COMPILING,
         running = RUNNING,
         dir = path2url(p.root()),
-        sep = SEP).as_slice()));
+        sep = SEP)));
 });
 
 test!(example_with_release_flag {
@@ -269,7 +270,7 @@ test!(example_with_release_flag {
         "#);
 
     assert_that(p.cargo_process("run").arg("-v").arg("--release").arg("--example").arg("a"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} bar v0.0.1 ({url})
 {running} `rustc bar{sep}src{sep}bar.rs --crate-name bar --crate-type lib \
         -C opt-level=3 \
@@ -295,10 +296,10 @@ fast2
         running = RUNNING,
         dir = p.root().display(),
         url = path2url(p.root()),
-        sep = SEP).as_slice()));
+        sep = SEP)));
 
     assert_that(p.cargo("run").arg("-v").arg("--example").arg("a"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} bar v0.0.1 ({url})
 {running} `rustc bar{sep}src{sep}bar.rs --crate-name bar --crate-type lib \
         -g \
@@ -324,7 +325,7 @@ slow2
         running = RUNNING,
         dir = p.root().display(),
         url = path2url(p.root()),
-        sep = SEP).as_slice()));
+        sep = SEP)));
 });
 
 test!(run_dylib_dep {
@@ -371,14 +372,14 @@ test!(release_works {
         "#);
 
     assert_that(p.cargo_process("run").arg("--release"),
-                execs().with_status(0).with_stdout(format!("\
+                execs().with_status(0).with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} `target{sep}release{sep}foo[..]`
 ",
         compiling = COMPILING,
         running = RUNNING,
         dir = path2url(p.root()),
-        sep = SEP).as_slice()));
+        sep = SEP)));
     assert_that(&p.release_bin("foo"), existing_file());
 });
 
index 08430fa7cb73ddc7573b165cfabb6e74991a0b07..1b8f8a69a182f99ee51f42b57a81328aac77c59c 100644 (file)
@@ -10,7 +10,7 @@ fn setup() {}
 
 test!(cargo_test_simple {
     let p = project("foo")
-        .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
+        .file("Cargo.toml", &basic_bin_manifest("foo"))
         .file("src/foo.rs", r#"
             fn hello() -> &'static str {
                 "hello"
@@ -48,7 +48,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
 
 test!(cargo_test_verbose {
     let p = project("foo")
-        .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
+        .file("Cargo.toml", &basic_bin_manifest("foo"))
         .file("src/foo.rs", r#"
             fn main() {}
             #[test] fn test_hello() {}
@@ -100,7 +100,7 @@ test!(many_similar_names {
 
 test!(cargo_test_failing_test {
     let p = project("foo")
-        .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
+        .file("Cargo.toml", &basic_bin_manifest("foo"))
         .file("src/foo.rs", r#"
             fn hello() -> &'static str {
                 "hello"
@@ -253,7 +253,7 @@ test!(test_with_deep_lib_dep {
     p2.build();
     assert_that(p.cargo_process("test"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {compiling} bar v0.0.1 ({dir})
 {running} target[..]
@@ -273,7 +273,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
 ",
                        compiling = COMPILING, running = RUNNING,
                        doctest = DOCTEST,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 });
 
 test!(external_test_explicit {
@@ -408,7 +408,7 @@ test!(pass_through_command_line {
 
     assert_that(p.cargo_process("test").arg("bar"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} target[..]foo-[..]
 
@@ -426,11 +426,11 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
 ",
                        compiling = COMPILING, running = RUNNING,
                        doctest = DOCTEST,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 
     assert_that(p.cargo_process("test").arg("foo"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} target[..]foo-[..]
 
@@ -448,14 +448,14 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
 ",
                        compiling = COMPILING, running = RUNNING,
                        doctest = DOCTEST,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 });
 
 // Regression test for running cargo-test twice with
 // tests in an rlib
 test!(cargo_test_twice {
     let p = project("test_twice")
-        .file("Cargo.toml", basic_lib_manifest("test_twice").as_slice())
+        .file("Cargo.toml", &basic_lib_manifest("test_twice"))
         .file("src/test_twice.rs", r#"
             #![crate_type = "rlib"]
 
@@ -547,7 +547,7 @@ test!(lib_with_standard_name {
 
     assert_that(p.cargo_process("test"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} syntax v0.0.1 ({dir})
 {running} target[..]syntax-[..]
 
@@ -572,7 +572,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
 
 ",
                        compiling = COMPILING, running = RUNNING,
-                       doctest = DOCTEST, dir = p.url()).as_slice()));
+                       doctest = DOCTEST, dir = p.url())));
 });
 
 test!(lib_with_standard_name2 {
@@ -602,7 +602,7 @@ test!(lib_with_standard_name2 {
 
     assert_that(p.cargo_process("test"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} syntax v0.0.1 ({dir})
 {running} target[..]syntax-[..]
 
@@ -613,7 +613,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
 
 ",
                        compiling = COMPILING, running = RUNNING,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 });
 
 test!(bin_there_for_integration {
@@ -625,15 +625,15 @@ test!(bin_there_for_integration {
             authors = []
         "#)
         .file("src/main.rs", "
-            fn main() { std::os::set_exit_status(1); }
+            fn main() { panic!(); }
             #[test] fn main_test() {}
         ")
         .file("tests/foo.rs", r#"
-            use std::old_io::Command;
+            use std::process::Command;
             #[test]
             fn test_test() {
                 let status = Command::new("target/debug/foo").status().unwrap();
-                assert!(status.matches_exit_status(1));
+                assert_eq!(status.code(), Some(101));
             }
         "#);
 
@@ -688,7 +688,7 @@ test!(test_dylib {
 
     assert_that(p.cargo_process("test"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} bar v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir})
 {running} target[..]foo-[..]
@@ -714,7 +714,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
 ",
                        compiling = COMPILING, running = RUNNING,
                        doctest = DOCTEST,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
     p.root().move_into_the_past().unwrap();
     assert_that(p.cargo("test"),
                 execs().with_status(0)
@@ -762,7 +762,7 @@ test!(test_twice_with_build_cmd {
 
     assert_that(p.cargo_process("test"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} target[..]foo-[..]
 
@@ -780,7 +780,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
 ",
                        compiling = COMPILING, running = RUNNING,
                        doctest = DOCTEST,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 
     assert_that(p.cargo("test"),
                 execs().with_status(0)
@@ -818,7 +818,7 @@ test!(test_then_build {
 
     assert_that(p.cargo_process("test"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} target[..]foo-[..]
 
@@ -836,7 +836,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
 ",
                        compiling = COMPILING, running = RUNNING,
                        doctest = DOCTEST,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 
     assert_that(p.cargo("build"),
                 execs().with_status(0)
@@ -858,11 +858,11 @@ test!(test_no_run {
 
     assert_that(p.cargo_process("test").arg("--no-run"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 ",
                        compiling = COMPILING,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 });
 
 test!(test_run_specific_bin_target {
@@ -899,7 +899,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
        dir = prj.url());
 
     assert_that(prj.cargo_process("test").arg("--bin").arg("bin2"),
-        execs().with_status(0).with_stdout(expected_stdout.as_slice()));
+        execs().with_status(0).with_stdout(&expected_stdout));
 });
 
 test!(test_run_specific_test_target {
@@ -930,7 +930,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
        dir = prj.url());
 
     assert_that(prj.cargo_process("test").arg("--test").arg("b"),
-        execs().with_status(0).with_stdout(expected_stdout.as_slice()));
+        execs().with_status(0).with_stdout(&expected_stdout));
 });
 
 test!(test_no_harness {
@@ -955,12 +955,12 @@ test!(test_no_harness {
 
     assert_that(p.cargo_process("test").arg("--").arg("--nocapture"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} target[..]bar-[..]
 ",
                        compiling = COMPILING, running = RUNNING,
-                       dir = p.url()).as_slice()));
+                       dir = p.url())));
 });
 
 test!(selective_testing {
@@ -1010,7 +1010,7 @@ test!(selective_testing {
     println!("d1");
     assert_that(p.cargo("test").arg("-p").arg("d1"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} d1 v0.0.1 ({dir})
 {running} target[..]d1-[..]
 
@@ -1025,12 +1025,12 @@ running 0 tests
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
 
 ", compiling = COMPILING, running = RUNNING,
-   dir = p.url()).as_slice()));
+   dir = p.url())));
 
     println!("d2");
     assert_that(p.cargo("test").arg("-p").arg("d2"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} d2 v0.0.1 ({dir})
 {running} target[..]d2-[..]
 
@@ -1045,12 +1045,12 @@ running 0 tests
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
 
 ", compiling = COMPILING, running = RUNNING,
-   dir = p.url()).as_slice()));
+   dir = p.url())));
 
     println!("whole");
     assert_that(p.cargo("test"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} target[..]foo-[..]
 
@@ -1059,7 +1059,7 @@ running 0 tests
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
 
 ", compiling = COMPILING, running = RUNNING,
-   dir = p.url()).as_slice()));
+   dir = p.url())));
 });
 
 test!(almost_cyclic_but_not_quite {
@@ -1212,7 +1212,7 @@ test!(selective_testing_with_docs {
 
     assert_that(p.cargo("test").arg("-p").arg("d1"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} d1 v0.0.1 ({dir})
 {running} target[..]deps[..]d1[..]
 
@@ -1227,7 +1227,7 @@ running 0 tests
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
 
 ", compiling = COMPILING, running = RUNNING, dir = p.url(),
-   doctest = DOCTEST).as_slice()));
+   doctest = DOCTEST)));
 });
 
 test!(example_bin_same_name {
@@ -1243,11 +1243,11 @@ test!(example_bin_same_name {
 
     assert_that(p.cargo_process("test").arg("--no-run").arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} `rustc [..]`
 {running} `rustc [..]`
-", compiling = COMPILING, running = RUNNING, dir = p.url()).as_slice()));
+", compiling = COMPILING, running = RUNNING, dir = p.url())));
 
     assert_that(&p.bin("foo"), is_not(existing_file()));
     assert_that(&p.bin("examples/foo"), existing_file());
@@ -1257,11 +1257,11 @@ test!(example_bin_same_name {
 
     assert_that(p.cargo("run"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 {compiling} foo v0.0.1 ([..])
 {running} [..]
 bin
-", compiling = COMPILING, running = RUNNING).as_slice()));
+", compiling = COMPILING, running = RUNNING)));
     assert_that(&p.bin("foo"), existing_file());
 });
 
@@ -1314,13 +1314,13 @@ test!(example_with_dev_dep {
 
     assert_that(p.cargo_process("test").arg("-v"),
                 execs().with_status(0)
-                       .with_stdout(format!("\
+                       .with_stdout(&format!("\
 [..]
 [..]
 [..]
 [..]
 {running} `rustc [..] --crate-name ex [..] --extern a=[..]`
-", running = RUNNING).as_slice()));
+", running = RUNNING)));
 });
 
 test!(bin_is_preserved {
index 7d8dc63360c17d7d3e4d03f9ada8477f6ea09dc2..0e19bbeeabf7caa2fd4effb351483fbb5d301c50 100644 (file)
@@ -8,11 +8,11 @@ test!(simple {
     let p = project("foo");
 
     assert_that(p.cargo_process("version"),
-                execs().with_status(0).with_stdout(format!("{}\n",
-        cargo::version()).as_slice()));
+                execs().with_status(0).with_stdout(&format!("{}\n",
+                                                            cargo::version())));
 
     assert_that(p.cargo_process("--version"),
-                execs().with_status(0).with_stdout(format!("{}\n",
-        cargo::version()).as_slice()));
+                execs().with_status(0).with_stdout(&format!("{}\n",
+                                                            cargo::version())));
 
 });
index 9d26721f6c53d864bba97fa5d343e03ac0d0c9bc..00d6054e81e17bc6207ad59af888fc08b8e9939c 100644 (file)
@@ -1,7 +1,7 @@
-#![feature(core, io, old_io)]
+#![feature(io, convert, thread_sleep)]
 #![feature(std_misc, io, fs, fs_ext, path_ext, fs_time, fs_walk)]
 
-extern crate "rustc-serialize" as serialize;
+extern crate rustc_serialize;
 extern crate cargo;
 extern crate flate2;
 extern crate git2;
@@ -54,7 +54,6 @@ mod test_cargo_test;
 mod test_cargo_version;
 mod test_shell;
 
-#[allow(deprecated)]
 fn sleep(dur: std::time::Duration) {
-    std::old_io::timer::sleep(dur)
+    std::thread::sleep(dur)
 }